[0..9] list (range) syntax
Michal Bozon
bozonm at vscht.cz
Wed Oct 24 18:44:28 EDT 2007
many Python newcomers are confused why
range(10), does not include 10.
If there was a proposal for the new
syntax for ranges, which is known
e.g. from Pascal or Ruby...
>>> [0..10]
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
...is there a chance to be approved ?
We have had a short discussion on it
at the irc, I hope that the fact
that nobody agreed it is a good idea
was just an accident :)
-m.
PS:
to dream further..
>>> (0..10)
<generator object at 0xb7618dac>
or
>>> (0..10)
(0..10)
or
>>> (0..10)
range(0, 11)
More information about the Python-list
mailing list