Status of PEP's?

Remco Gerlich scarblac at pino.selwerd.nl
Thu Feb 28 12:21:23 CET 2002


Fernando Pérez <fperez528 at yahoo.com> wrote in comp.lang.python:
> Python is a general purpose language, not one to be used only by number 
> theorists. Putting at a level as basic as the integers a convention which 
> allows things like 'for i in 3' to be valid iteration code really sounds 
> bizarre and counter intuitive to me.
> 
> But maybe it's just me.

It's not just you.

I believe syntax like 'for i in 5:' is confusing (at first sight I'd think
that i would get one value, 5), and has no merit except saving a few key
strokes compared to 'for i in range(5):', which is clearer as well.

Compare:

for i in 6: print i
for i in 6,7: print i
for i in 6,7,8: print i

You wouldn't think the first line does something different, would you?


-- 
Remco Gerlich



More information about the Python-list mailing list