PEP 284, Integer for-loops

phil hunt philh at comuno.freeserve.co.uk
Fri Mar 8 12:01:40 EST 2002


On 07 Mar 2002 15:27:01 -0800, Paul Rubin <phr-n2002a at nightsong.com> wrote:
>Courageous <jkraska at san.rr.com> writes:
>> >This syntax could easily be extend, to allow a step other than 1:
>> >
>> >   for i = 1 to 10 step 3:
>> 
>> Or:
>> 
>> 	for i = 10 to 1 step -1:
>
>This is fine.
>
>> Further, in ranges which step from high to low, the step can be
>> inferred.
>
>This doesn't sound good.  Suppose you say
>
>      for i = a to b:
>
>where you don't know at compile time the values of a and b.
>Do you really want it to count backwards if b < a?   I usually wouldn't.

Nor would I.

-- 
<"><"><"> Philip Hunt <philh at comuno.freeserve.co.uk> <"><"><">
"I would guess that he really believes whatever is politically 
advantageous for him to believe." 
                        -- Alison Brooks, referring to Michael
                              Portillo, on soc.history.what-if



More information about the Python-list mailing list