flattening a dict

Boris Borcic bborcic at gmail.com
Tue Feb 19 12:17:14 CET 2008

Duncan Booth wrote:

> In this particular case I think the lambda does contribute to the
> obfuscation. Yes, they are single expressions, but only because that
> have been contorted to become single expressions.  The first two return
> generators, so if you don't force them into a lambda you can write them
> out as for loops with yield. The last one is an if..else statement.

The key word is "become", and in this particular case the discussion thread is 
witness to the fact that it doesn't apply as you say. The three single 
expressions came about from a (misshappen, OK, but I never pretended otherwise) 
attempt to divide into pieces what was already a single expression in Arnaud's 
code while keeping in the spirit.

BTW, I have a particular issue with your statement :

 >> A lambda which is assigned directly to a variable is a bad code smell.

My problem is that I can't discuss its pure content with which I simply 
disagree, because that would legitimize its abstracted form with which I have 
the strongest issues, although largely OT.

Best, BB

More information about the Python-list mailing list