Tim N. van der Leeuw wrote:
In my taste, using generator expressions with conditions actually
doesn't look very readable; it hides the set-membership test under the
syntactic clutter.

You might try different indentation. I find that I write a lot of my list comprehensions and generator expressions like:


dict((k, v)
     for k, v in d.iteritems()
     if k in s)

It looks much more like the for-loop in my mind, and I can easily spot each of the for- and if-expressions in the genexp.

STeVe
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to