On Wed, Feb 22, 2012 at 01:55:01PM +0000, Vincent Delecroix wrote:
> Hello,
> 
> .cardinality() method of InfiniteEnumeratedSets is not implemented in
> ParentMethods of the corresponding category. Is there a reason for
> that ?

???

infinite_enumerated_sets.py line 56-120:


    class ParentMethods:

        def is_finite(self):
            """
            Returns ``False`` since self is not finite.

            EXAMPLES::

                sage: C = InfiniteEnumeratedSets().example()
                sage: C.is_finite()
                False
            """
            return False

        def cardinality(self):
            """
            Counts the elements of the enumerated set.

            EXAMPLES::

                sage: NN = InfiniteEnumeratedSets().example()
                sage: NN.cardinality()
                +Infinity
            """
            from sage.rings.infinity import infinity
            return infinity

        def random_element(self):
            """
            Returns an error since self is an infinite enumerated set.

            EXAMPLES::

                sage: NN = InfiniteEnumeratedSets().example()
                sage: NN.random_element()
                Traceback (most recent call last):
                ...
                NotImplementedError: infinite set

            TODO: should this be an optional abstract_method instead?
            """
            raise NotImplementedError, "infinite set"

        def list(self):
            """
            Returns an error since self is an infinite enumerated set.

            EXAMPLES::

                sage: NN = InfiniteEnumeratedSets().example()
                sage: NN.list()
                Traceback (most recent call last):
                ...
                NotImplementedError: infinite list
            """
            raise NotImplementedError, "infinite list"
        _list_default  = list # needed by the check system.

...

Florent

-- 
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-devel@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.

Reply via email to