[Python-Dev] string representation of range in 3.0

Aahz aahz at pythoncraft.com
Thu Apr 17 16:25:34 CEST 2008


On Tue, Apr 15, 2008, Guido van Rossum wrote:
> 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

No, they can't.  ;-)

(print is a function in 3.0....)

This may seem like a minor nit -- and it is, in some ways -- but I think
reminding people of the pedagogical issues involved in the transition is
important.  Granted, this is python-dev, so we should be using 2.x
syntax, but we're currently talking about 3.0 and that requires
clarifying what is meant/intended.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"It is easier to optimize correct code than to correct optimized code."
--Bill Harlan


More information about the Python-Dev mailing list