Design discussion for permutations and discrete functions
This is about permutations, and more generally about functions between finite sets.
Desirable features:
- - Python mantra: an object which looks like a list should behave like a list.
- I.e. if the users sees
sage: p = ... sage: p [4,1,3,2]
- Then he will expect
sage: p[0] 4
- any finite set, and manipulate them as is, without translations
sage: F = Functions([3,4,8]) sage: F.list() [3,3,3] [3,3,4] [3,3,8] ... [8,8,8] sage: p = F([8,3,4]) [8,3,4]
- In particular, whatever the syntax is, one want to be able to do
sage: p of 3 8 sage: p of 3 = 4 sage: p [4,3,4]
- [0...n-1] for speed (future cythonization)
Potential solutions:
- - current one
sage: p = Permutation([3,1,2]) sage: p[0] 3 sage: p[0] = 1; p[1] = 3 # actually not implemented
