list comprehension question

phil hunt philh at comuno.freeserve.co.uk
Mon Mar 25 11:48:50 EST 2002


On Sun, 24 Mar 2002 17:44:44 -0800, Emile van Sebille <emile at fenx.com> wrote:
>brueckd at tbye.com
>> >>> lo, hi = 1, 3
>> >>> [x/2 + 0.1*(x%2) for x in xrange(lo*2, (hi+1)*2)]
>>
>
>Which, after only a few moments of inverse re-factorization as per YP*
>practice, devolves into:
>
>>>> [round(map(float, [int(x/2) + 0.1*(int(x%2))])[0]*10)/10.
>        for x in map(int,xrange(lo*2, (hi+1)*2))]
>
>* something had to come before XP...  ;-)

WP, surely?

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