Changes between Initial Version and Version 1 of Ticket #13688


Ignore:
Timestamp:
Nov 6, 2012, 5:55:20 PM (10 years ago)
Author:
Travis Scrimshaw
Comment:

Tweaked example to show we don't want to change the semantics of cardinality().

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #13688 – Description

    initial v1  
    11Right now the category `FiniteEnumeratedSets` overrides a parent class's `cardinality()` when creating a list. Below is a minimal example of this behavior:
    2 {{{
     2{{{#!python
    33from sage.structure.parent import Parent
    44from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets
     
    1212        return
    1313
    14     def cardinality(self, n):
     14    def cardinality(self, bad_arg):
    1515        """
    1616        EXAMPLES::
     
    1818            sage: P = sage.combinat.category_doctest_fail.TestParent()
    1919            sage: P.cardinality(-1)
    20             -1
     20            1
    2121            sage: v = P.list(); v
    2222            [1]
     
    2626            1
    2727            sage: P.cardinality(-1) # This test breaks
    28             -1
     28            1
    2929        """
    30         return n
     30        return 1 # we don't want to change the semantics of cardinality()
    3131}}}
    3232