On Tue, Dec 28, 2010 at 12:06:52PM -0800, Eviatar wrote: > What is "an_element" supposed to do, exactly? Should it return the > first item in a list, a random one, etc?
Does this help? sage: C = Sets().parent_class sage: C.an_element? ... Docstring: Returns a (preferably typical) element of this parent. This is used both for illustration and testing purposes. If the set ``self`` is empty, ``an_element()`` should raise the exception ``EmptySetError``. This default implementation calls ``_an_element_()`` and cache the result. Any parent should implement either ``an_element()`` or ``_an_element_()``. sage: C = EnumeratedSets().parent_class sage: C._an_element_? Type: CachedMethodCaller Base Class: <class 'sage.misc.cachefunc.CachedMethodCaller'> String Form: Cached version of <function _an_element_from_iterator at 0x2a93de8> Namespace: Interactive File: /opt/sage/local/lib/python2.6/site-packages/sage/misc/cachefunc.py Definition: C._an_element_(self, *args, **kwds) Docstring: An element in ``self``. ``self.an_element()`` returns a particular element of the set ``self``. This is a generic implementation from the category ``EnumeratedSets()`` which can be used when the method ``__iter__`` is provided. Cheers, Nicolas -- Nicolas M. Thiéry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-de...@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en.