[Python-Dev] string representation of range in 3.0

Guido van Rossum guido at python.org
Wed Apr 16 06:45:42 CEST 2008


On Tue, Apr 15, 2008 at 8:34 PM, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Guido van Rossum wrote:
>  > That's why I proposed <0, 1, ..., 9> for repr(range(10)).
>
>  My worry is that this will lead a newcomer into thinking
>  this is some kind of valid expression syntax.

You and Steven D'Aprano both.

So if this is indeed a bad idea, I'm stumped -- the 3.0 status quo is
the best we can do, and teachers will just have to teach their
students to write list(range(10)) if they want to see what it means.
Or they can write an explicit for-loop (always useful on the first
day):

  for i in range(10):
    print i

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list