[Python-ideas] Accessing the result of comprehension's expression from the conditional
Lie Ryan
lie.1296 at gmail.com
Sat Jun 20 20:35:21 CEST 2009
Georg Brandl wrote:
> Lie Ryan schrieb:
>> That's ugly because of the same reason for using map():
>> [y for y in map(lambda x: f(x), seq) if y > 0]
>
> Especially if f is already a handy callable of one argument, no need to use
> a lambda.
Ahh... yes. Sometimes I actually meant f(x) to be a substitute to any
expression (both simple: x**2 or complex: foo(x))
but well, I didn't actually see that one...
More information about the Python-ideas
mailing list