Hi Travis! Answering on sage-combinat-devel since trac access is to slooooow from here.
----- Forwarded message from Sage <wst...@math.washington.edu> ----- Right now the category `FiniteEnumeratedSets` overrides a parent class's `cardinality()` when creating a list. Below is a minimal example of this behavior: {{{ from sage.structure.parent import Parent from sage.categories.finite_enumerated_sets import FiniteEnumeratedSets class TestParent(Parent): def __init__(self): Parent.__init__(self, category=FiniteEnumeratedSets()) def __iter__(self): yield 1 return def cardinality(self, n): """ EXAMPLES:: sage: P = sage.combinat.category_doctest_fail.TestParent() sage: P.cardinality(-1) -1 sage: v = P.list(); v [1] sage: len(v) 1 sage: P.cardinality() 1 sage: P.cardinality(-1) # This test breaks -1 """ return n }}} This seems to be caused by not checking if the parent class has a `cardinality()` function implemented, and just overriding it with `_cardinality_from_list()` (which takes no [optional] parameters). ------------------------------------------------------------------------------ Yes: under the current conventions, the cardinality method is not supposed to take an argument. So if the list of elements has been computed, it can be safely overwritten by something faster. Do you have a strong rationale for deviating from the conventions? Cheers, Nicolas -- You received this message because you are subscribed to the Google Groups "sage-combinat-commits" group. To post to this group, send email to sage-combinat-comm...@googlegroups.com. To unsubscribe from this group, send email to sage-combinat-commits+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/sage-combinat-commits?hl=en. ----- End forwarded message ----- 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-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.