#5308: Removing __len__ for combinatorial classes
---------------------------+------------------------------------------------
 Reporter:  hivert         |       Owner:  hivert                             
     Type:  enhancement    |      Status:  assigned                           
 Priority:  major          |   Milestone:  sage-combinat                      
Component:  combinatorics  |    Keywords:  __len__, count, combinatorial class
---------------------------+------------------------------------------------
Description changed by hivert:

Old 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 because.
> 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
> .count() instead.
>
> Some part of combinat has to be fixed accordingly.

New 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

--

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5308#comment:2>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to