PEP 276 Simple Iterator for ints (fwd)

David Eppstein eppstein at
Wed Nov 28 06:59:42 CET 2001

In article <3C04768A.CFDC1CE8 at>,
 Peter Hansen <peter at> wrote:

> > > -1 for being ambiguous to newbies.  
> > 
> > The same could be said for 'for i in range(5)', since 'i in range(5)' is an
> > expression that is roughly equivalent to '0 <= i < 5'.
> But range() can be looked up.  You can type range(5) at the interactive 
> prompt (where a newbie would live) and see [0, 1, 2, 3, 4] and infer 
> immediately that you are stepping through the items one at a time. 
> Typing 0 <= i < 5 at the prompt gives you either 0 or 1, or NameError: 
> name 'i' is not defined. Not helpful for a newbie.

How would the newbie know to type "range(5)" instead of "i in range(5)"?

> (Note: I'm not exactly interested in dumbing a language down to the 
> point where anyone can understand it without learning something from a 
> tutorial or the reference.

When you phrase it that way, I'm not either -- what does it mean to dumb 
down a language? -- but I would be interested in changes that allow 
non-Python-literate programmers to understand my code without having to 
dig through a manual.
David Eppstein       UC Irvine Dept. of Information & Computer Science
eppstein at

More information about the Python-list mailing list