Anonymus functions revisited : tuple actions

George Sakkis gsakkis at
Fri Mar 25 09:18:49 CET 2005

"Kay Schluehr" <kay.schluehr at> wrote:

> To make my intention clear for another time, also for George who
> mistrusts these exercises alltogether. I want to derive a syntax and
> semantics for anonymus functions ( called "tuple-actions" ) that are
> generalizations of rules that are already used implicitely within
> Python e.g. tuple-unpacking. This is done by progressive interpretation
> and extension. They are not there by means of an accident, what Guido
> claims about the current lambda which he feels to be sticked onto the
> language.
> Regards,
> Kay

I'd be glad to see a well-formulated view of the proposed tuple actions, provided I (and suspect
others) can get through the syntax burden first. Expressions such as "While((i)->(0), (i)->i<3,
(i)->(i+1), (res)->(res+i**2))" do not remind me the python I know and love. Alternatively, if it's
not easy to come up with a grokable syntax, I would still be ok with it if it remained "under the
hood" for the most part, like other obscure features such as metaclasses and descriptors; for
instance I wouldn't mind at all if the traditional control flow primitives were implemented as
functions using your idea, as long as I didn't have to know the details (and as long as other
things, e.g. execution speed, were the same).

As for the forthcoming - as it seems - deprecation or removal of lambdas, I'm in the minority that
thinks it's a step in the wrong direction. The way they ended up in the language may be a historic
accident, but I would favor a solution that improved them instead of removing them. The notion of
'anonymous functions' alone reveals a misconception in my opinion: that functions *have to* have a
name to be 'normal'. Still, a name is just a binding to an object that exists independently of the
name. We don't find 'anonymous strings', tuples, lists, etc. bad, so why should functions be
different ? In this respect, functions are not 100% first class objects. Instead of removing
lambdas, I would prefer to see them upgraded, perhaps with a new syntax, accepting more than one
expressions and statements instead of a single expression. Sure, one can define named functions
locally to avoid polluting the global scope, but why should he ? Just imagine how would python look
like with a similar rule for other primitive types. Anyway, I guess I can live without lambdas but
I'll miss them.


More information about the Python-list mailing list