[Python-ideas] Assignments in list/generator expressions

Carl M. Johnson cmjohnson.mailinglist at gmail.com
Sun Apr 10 01:44:12 CEST 2011


The lack of local assignment is a feature. It keeps people from trying
to write overly complex one-liners. It is better to separate each step
out into a generator expression on a different line of the final
program, so that things don't become so dense you can't tell at a
glance what's going on. Or heck, you could just use a for-loop if what
you're trying to do is complicated enough.



More information about the Python-ideas mailing list