def _an_element_(self): """ Try to return an element of ``self``, as per :meth:`Sets.ParentMethods.an_element`. For each parent ``self`` is a facade for, this default implementation tries the method ``an_element`` until it finds an element in ``self``. If none is found raise a ``NotImplementedError``. EXAMPLES:: sage: S = Sets().Facades().example(); S An example of facade set: the monoid of positive integers sage: S.an_element() 1 """ for parent in self.facade_for(): x = parent.an_element() if x in self: return x raise NotImplementedError
def _an_element_(self): """ Try to return an element of ``self``, as per :meth:`Sets.ParentMethods.an_element`. For each parent ``self`` is a facade for, this default implementation tries the method ``an_element`` until it finds an element in ``self``. If none is found raise a ``NotImplementedError``. EXAMPLES:: sage: S = Sets().Facade().example(); S An example of facade set: the monoid of positive integers sage: S.an_element() 1 """ for parent in self.facade_for(): x = parent.an_element() if x in self: return x raise NotImplementedError