what's wrong with "lambda x : print x/60,x%60"
Paul Rubin
http
Mon Dec 5 22:24:59 EST 2005
Steve Holden <steve at holdenweb.com> writes:
> Defining a function, and giving it a name,
> isn't "polluting the namespace", any more than assigning
> sub-expressions to temporary variables is polluting the namespace.
Nor any less.
> Why use temporary variables when all you have to do is make your
> expressions three lines long to avoid "polluting the namespace"?
Indeed. I'd much rather say
x = a + b + (c * d) + e
than
temp1 = a + b
temp2 = c * d
temp3 = temp1 + temp2
x = temp3 + e
I don't understand why the critics of lambda don't understand that
having to use so many temp variables, for either numbers or functions,
can work against both concision and clarity.
> Even without shouting "Namespaces are a honking good idea, let's do
> more of those", I should just like to make a small plea for everyone
> to remember that namespaces are there specifically to allow us to name
> things!
Not everything needs a name.
More information about the Python-list
mailing list