else condition in list comprehension

Nick Coghlan ncoghlan at iinet.net.au
Thu Jan 13 09:46:04 EST 2005


Andrey Tatarinov wrote:
>> I presume the point of this is to avoid polluting the local namespace 
>> with "newval". I further presume you also have plans to do something 
>> about "i"? ;-)
> 
> no, the point is in grouping definition of newval() with place where it 
> is used.

I'd have said the point was both :)

But yeah, unfortunately the 'leaking list comp' problem won't be fixed in the 
2.x series due to the compatibility problem. Fortunately, generator expressions 
didn't inherit the issue.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.skystorm.net



More information about the Python-list mailing list