else condition in list comprehension

Nick Coghlan ncoghlan at iinet.net.au
Thu Jan 13 15:46:04 CET 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.


Nick Coghlan   |   ncoghlan at email.com   |   Brisbane, Australia

More information about the Python-list mailing list