
Feb. 26, 2010
9:50 a.m.
On Thu, 25 Feb 2010 18:35:17 -0500 Fred Drake <fdrake@acm.org> wrote:
On Thu, Feb 25, 2010 at 6:40 PM, Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
[x from numbers if x%2==1]
I like this, but it has the same readability issue I noted for cases where decomposition is used:
[(k, v) from somedict.items() if condition(v)]
You're right on readability. On the other hand, unpacking is a common practice in python. Can this be mis-interpreted? (I mean, is it ambiguous?) Also note that custom iterators can generate "items" of arbitrary complexity. This point cannot be addressed by the syntax for comprehensions. Denis -- ________________________________ la vita e estrany spir.wikidot.com