[Python-ideas] Accessing the result of comprehension's expression from the conditional
Paul Moore
p.f.moore at gmail.com
Sun Jun 21 16:59:51 CEST 2009
2009/6/21 Lie Ryan <lie.1296 at gmail.com>:
>> It can even be done as a single expression without (IMO) significantly
>> affecting readability::
>>
>> result = [
>> b for (a, b) in
>> ((x, 3*x**2-5*x+4) for x in seq if x % 3 != 2)
>> if -a < b < a]
>
> IMHO, when a comprehension requires more than a single line, it should
> turn into explicit loop.
Hang on - isn't the whole point of this thread that, in your opinion,
when a comprehension gets complex, it requires new syntax? :-)
Paul.
More information about the Python-ideas
mailing list