PEP 284, Integer for-loops

phil hunt philh at comuno.freeserve.co.uk
Thu Mar 7 11:29:48 EST 2002


On Wed, 06 Mar 2002 15:35:06 -0800, David Eppstein <eppstein at ics.uci.edu> wrote:
>In article <slrna8d8ej.utc.grey at teleute.dmiyu.org>,
> Steve Lamb <grey at despair.dmiyu.org> wrote:
>
>> I fail to see how it is is greader readability or understanding when the
>> current method is both.
>
>I diagree that the current method has both, or either.  I don't know 
>about you, but I find "for x in range(n-1,-1,-1)" to be a difficult to 
>read and difficult to understand way of obfuscating a simple loop over 
>the numbers 0 to n-1 in reverse order.  I think "for n > x >= 0" would 
>be much simpler.

I think 

   for x = n-1 to 0 step -1:

would be about as obvious as it gets

-- 
<"><"><"> 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