Hey Nicolas, Yes, that was a bad example...I'll tweak the example on trac.
Personally I'm leaning towards the second option because it is more flexible since there may be other arguments a user (developer) might need. However this seems to not by pythonic, and if we do the first option, we make it so that user has the change the category, so the user (in principle) knows that the semantic should not change the output. Also, do we want the doc of cardinality() to remain the original implementation's doc (i.e. not change to cardinality_from_list()'s doc)? Thanks, Travis Ok, in that use case, the extra parameters (algorithm) are not > changing the semantic of the output. Since we have already computed > the list of the elements of ``self``, getting its cardinality from > that list is for free; thus calling cardinality_from_list is at least > as good as any other implementation. > > Now what you are saying is that cardinality_from_list is not a drop-in > replacement for a cardinality method taking an "algorithm" optional > arguments, because cardinality_from_list will bark at those optional > argument instead of just ignoring it. That's a good point! > > What about: > > - Writing in stone in the Set's category that, for `X` a set, the > semantic of X.cardinality(...) is to always return the number of > element of `X` regardless of the arguments. Otherwise said, the only > valid arguments would be things like "algorithm =...". > > - Having cardinality_from_list ignore all its argument. > > Cheers, > Nicolas > -- > Nicolas M. Thi�ry "Isil" <nth...@users.sf.net <javascript:>> > http://Nicolas.Thiery.name/ > -- You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To view this discussion on the web visit https://groups.google.com/d/msg/sage-combinat-devel/-/yDM_KwILyE0J. 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.