-
-
Notifications
You must be signed in to change notification settings - Fork 689
Description
After some discussion on sage-combinat-devel, it was decided that __len__ should no be used to get the size of a combinatorial class. Indeed the specifications of __len__ says that it has to return a plain python int, whereas we want to deal with huge and even infinite sets. Unfortunately due to __len__ being called by list / filter / map and maybe some other functions, it is not possible to issue a warning. So it was decided to simply remove it and issue an error, telling to call .cardinality() instead. The former usage of .count() is also deprecated.
Combinat has to be adapted to this and also to the deprecation of iterator in favor of __iter__
I'm preparing a patch to solve those issues.
Cheers,
Florent
CC: @sagetrac-sage-combinat
Component: combinatorics
Keywords: len, count, combinatorial class
Issue created by migration from https://trac.sagemath.org/ticket/5308