[Python-ideas] YAML (yet-another-multiline-lambda)

Stephen J. Turnbull stephen at xemacs.org
Thu Oct 24 12:10:04 CEST 2013


Antony Lee writes:

 > as I mentioned earlier I don't really see the need

It's not a *need*, it's a *style*.  Ie, it's just the way Pythonistas
do things.

Many fledgling Pythonistas, especially those who come from other
languages, hanker after anonymous functions or Ruby blocks (a somewhat
different concept AFAICT), and some experienced Pythonistas sympathize
with them.  But there's no real reason why some functions shouldn't
have a name, and Guido (the ultimate authority on "Pythonic") isn't a
fan of lambda, so (unless a pressing need or a really good syntax
appears) there seems to be little chance of the existing feature
(expressions as lambdas) being extended.

 > for binding lambdas to objects in the first place.

I think you've misspoken here.  Lambdas *are* objects, and that's why
names can be bound to them (and then they're called "functions").
What people complain about is the fact that the normal way to create a
lambda (callable function object or something like that) is "def",
which also binds a name to the object.  They think that is wasteful or
something.

Steve


More information about the Python-ideas mailing list