PEP 276 Simple Iterator for ints (fwd)

David Eppstein eppstein at ics.uci.edu
Tue Nov 27 19:36:51 EST 2001


In article <slrna0824s.1ra3.Gareth.McCaughan at g.local>,
 Gareth.McCaughan at pobox.com (Gareth McCaughan) wrote:

> 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 if it also groks "for 0 < i <= 5" and so on.

Also +1 if it gives the reversed sequence for "for 5 > i >= 0".

I don't much care about nice syntax for increments other than 1 and -1.
-- 
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