PEP 276 Simple Iterator for ints (fwd)

Peter Hansen peter at engcorp.com
Wed Nov 28 04:52:50 CET 2001


Greg Ewing wrote:
> 
> While trying to think of a range syntax that looks
> unambiguously half-open without clashing with list
> or tuple constructors, the following blindingly
> obvious solution occurred to me:
> 
>   for 0 <= i < 5:
>     ...

-1 for being ambiguous to newbies.  What would
that mean, start and zero and go until four?
Probably, but *I* read the previous thread on this.
If a newbie had just learned about Python's ability
to evaluate 0 <= i < 5 and return 1 or 0 for true/false
the above might be a little perplexing.  Is it like
for 1: if i is in that range, and for 0: if not?

Just in typing the above I had to hit backspace
three times to type it right.  May "look" nice
to some, but too obscure to others I think.
Why fix what doesn't need fixing?

-- 
----------------------
Peter Hansen, P.Eng.
peter at engcorp.com



More information about the Python-list mailing list