[Python-ideas] Accessing the result of comprehension's expression from the conditional

Lie Ryan lie.1296 at gmail.com
Sat Jun 20 21:51:09 CEST 2009


Terry Reedy wrote:
> Steven D'Aprano wrote:
>> On Sat, 20 Jun 2009 08:31:26 am Lie Ryan wrote:
> 
>> You don't like lambda? Fine, define an external function first. Then
>> you can write:
>>
>> filter(pred, (f(x) for x in seq))
>>
>> There's no violation of DRY, there's no redundancy, there's no lambda,
>> there's no "y" variable needed. What's ugly about it?
> 
> I think its great and that it kills any justification for the proposal.
> 
> tjr

I hate it. It mixes map/filter style and comprehension style; and the
fact it does so in a single line only makes it worse. Not that it would
be any better in two lines.




More information about the Python-ideas mailing list