PEP 276 Simple Iterator for ints (fwd)

David Eppstein eppstein at ics.uci.edu
Wed Nov 28 06:59:42 CET 2001


In article <3C04768A.CFDC1CE8 at engcorp.com>,
 Peter Hansen <peter at engcorp.com> 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 ics.uci.edu http://www.ics.uci.edu/~eppstein/



More information about the Python-list mailing list