[Python-Dev] Lukewarm about range literals (original) (raw)

Guido van Rossum guido@beopen.com
Tue, 29 Aug 2000 11:37:40 -0500


How about a:b to indicate the range starting at a and ending with b-1?

I believe this is what the Nummies originally suggested.

which doesn't look so bad to me, but is probably ambiguous. Hmmm, could this possibly work or is it too much of a collision with the use of `:' to indicate block structure?

Alas, it could never work. Look at this:

for i in a:b:c

Does it mean

for i in (a:b) : c

or

for i in a: (b:c)

?

So we're back to requiring some form of parentheses.

I'm postponing this discussion until after Python 2.0 final is released -- the feature freeze is real!

--Guido van Rossum (home page: http://www.pythonlabs.com/~guido/)