[Python-ideas] Assignments in list/generator expressions

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Apr 10 23:09:50 CEST 2011


Laura Creighton wrote:

> We'll have to disagree then.  I think 'for name in [expr]' is a whole
> lot more readable than 'with name = expr'.

I think I would find 'where name = expr' slightly more
readable and aesthetically pleasing than either
'with name = expr' or 'for name in [expr]'.

However if 'for name in [expr]' were optimised to use
an assignment instead of a for-loop, I might consider
using it more often. Currently I would be reluctant to
do so because it feels so inefficient.

-- 
Greg



More information about the Python-ideas mailing list