PEP 284, Integer for-loops

David Eppstein eppstein at ics.uci.edu
Wed Mar 6 16:37:01 EST 2002


In article <mailman.1015435158.24789.python-list at python.org>,
 "Roman Yakovenko" <romany at actimize.com> wrote:

> What is about step ?
> 
> for( int I = 0; I < 10; I+=2)
> 	do smth

The proposal doesn't address arithmetic progressions, geometric 
progressions, or any other type of sequence: just intervals of 
consecutive integers.

But if you expanded your example a little:

for (int l = 0; l < 10; l += 2)
   do smth(l)

you would see that it is easy to handle it with the proposed new syntax:

for 0 <= h < 5:
    do smth(2*h)



More information about the Python-list mailing list