Arithmetic sequences in Python
apardon at forel.vub.ac.be
Wed Jan 18 09:10:19 CET 2006
Op 2006-01-17, Gregory Petrosyan schreef <gregory.petrosyan at gmail.com>:
> Hey guys, this proposal has already been rejected (it is the PEP 204).
No it isn't. In my proposal [1, 2:8, 8] would be equivallent to
[1, slice(2,8), 8]. If someone would want the list [1,2,3,4,5,6,7,8]
with this notation, I would propose a flatten function witch would
work with iterators too, so that flat([1, 2:8, 8]) would be the
same as flat([1, range(2,8), 8])
In my view python already has slice literals. You are only limited
in using this literals an index in subscription. I think this is
a rathter pointless limitation and that literal slices could be
very usefull when made into literals and usable as parameters.
More information about the Python-list