[Python-Dev] Lukewarm about range literals
Skip Montanaro
skip@mojam.com (Skip Montanaro)
Mon, 28 Aug 2000 16:46:19 -0500 (CDT)
Guido> I notice that:
Guido> for i in [:100]: print i
Guido> looks a bit too much like line noise. I remember that Randy
Guido> Pausch once mentioned that a typical newbie will read this as:
Guido> for i in 100 print i
Just tossing out a couple ideas here. I don't see either mentioned in the
current version of the PEP.
1. Would it help readability if there were no optional elements in range
literals? That way you'd have to write
for i in [0:100]: print i
2. Would it be more visually obvious to use ellipsis notation to
separate the start and end inidices?
>>> for i in [0...100]: print i
0
1
...
99
>>> for i in [0...100:2]: print i
0
2
...
98
I don't know if either are possible syntactically.
Skip