what's wrong with "lambda x : print x/60,x%60"

Sybren Stuvel sybrenUSE at YOURthirdtower.com.imagination
Mon Dec 5 18:27:17 EST 2005


rurpy at yahoo.com enlightened us with:
> No, it is not merely a shortcut.  It often allows one to avoid
> polluting the namespace with a completely superfluous function name,
> thus reducing code smell.

Which can also be done by using inner functions.

> It can also avoid a multi-line function defintion which often pushes
> other relevant code off the current page and out of view, and thus
> lambda can increase program readability.

def somefunc(x): return x*5

How is that a multi-line function definition?

Sybren
-- 
The problem with the world is stupidity. Not saying there should be a
capital punishment for stupidity, but why don't we just take the
safety labels off of everything and let the problem solve itself? 
                                             Frank Zappa



More information about the Python-list mailing list