Ticket #7510: trac_7510-is_finite_categories.patch

File trac_7510-is_finite_categories.patch, 1.6 KB (added by hivert, 13 years ago)
  • sage/categories/finite_enumerated_sets.py

    # HG changeset patch
    # User Florent Hivert <Florent.Hivert@univ-rouen.fr>
    # Date 1258843384 -3600
    # Node ID a84c31a2570a8255fe4f2619d880c2d64e2d6545
    # Parent  fa4768ea6dda69a6f8ddc9a1629837a31d67bf04
    Added is_prime methods in (Finite|Infinite)EnumeratedSets.
    
    diff --git a/sage/categories/finite_enumerated_sets.py b/sage/categories/finite_enumerated_sets.py
    a b class FiniteEnumeratedSets(Category): 
    4848
    4949    class ParentMethods:
    5050
     51        def is_finite(self):
     52            """
     53            Returns ``True`` since self is finite.
     54
     55            EXAMPLES::
     56
     57                sage: C = FiniteEnumeratedSets().example()
     58                sage: C.is_finite()
     59                True
     60            """
     61            return True
     62
    5163        def _cardinality_from_iterator(self):
    5264            """
    5365            The cardinality of ``self``.
  • sage/categories/infinite_enumerated_sets.py

    diff --git a/sage/categories/infinite_enumerated_sets.py b/sage/categories/infinite_enumerated_sets.py
    a b class InfiniteEnumeratedSets(Category): 
    5353        return [EnumeratedSets()]
    5454
    5555    class ParentMethods:
     56
     57        def is_finite(self):
     58            """
     59            Returns ``False`` since self is not finite.
     60
     61            EXAMPLES::
     62
     63                sage: C = InfiniteEnumeratedSets().example()
     64                sage: C.is_finite()
     65                False
     66            """
     67            return False
     68
    5669        def cardinality(self):
    5770            """
    5871            Counts the elements of the enumerated set.