more fun with PEP 276

David Eppstein eppstein at ics.uci.edu
Wed Dec 12 18:12:48 CET 2001


In article <slrna1f1le.4t5.philh at comuno.freeserve.co.uk>,
 philh at comuno.freeserve.co.uk (phil hunt) wrote:

> how about:
> 
>    for i in -5 to 5:
> 
> or
> 
>    for i in -5 to 5 step 2:
> 
> 
> Here, "to" and "to...step" are keywords that create an xrange with the
> required values

Not bad, but seems to force closed intervals only, which is somewhat at 
odds with other features of Python.
-- 
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