Opened 11 years ago

Last modified 10 years ago

#11125 new enhancement

Change .list() to return an immutable object in enumerated sets.

Reported by: hivert Owned by: hivert
Priority: major Milestone:
Component: combinatorics Keywords: list EnumeratedSet
Cc: sage-combinat Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

Currently, in enumerated sets, the method .list() returns a standard mutable python list. This is unfortunate because, even if we use caching, we need a new copy of the list to make sure that the user doesn't change the cached list. This copy is made, even if the user don't change the returned list. The good way of resolving this problem must be discussed further but I nevertheless create the ticket for reference.

Change History (1)

comment:1 Changed 10 years ago by vbraun

+1 from me ;-)

Just to repeat what I said on sage-devel: List can be understood as "Python list", but also as as the English verb for "series of records". In the latter sense it is perfectly fine to return a Python tuple. But if you really can't live with the cognitive dissonance you can call it enumerate() with an alias list().

Note: See TracTickets for help on using tickets.