[Python-ideas] pep 312 - implicit lambdas idea

Ben Finney ben+python at benfinney.id.au
Fri Aug 7 16:06:59 CEST 2009

ilya <ilya.nikokoshev at gmail.com> writes:

> I was thinking about a good syntax for implicit lambdas for a while

Why were you thinking of this, and why is it important enough to
override “explicit is better than implicit”?

> and today I had this idea: make ``_:`` a shortcut for ``lambda
> _=None:``


The name ‘_’ already sees a lot of use as an identifier. It is in common
use as a conventional shortcut to the ‘gettext.gettext’ function. It is
also commonly used as a name to bind to a value that is returned from
some process but not actually needed.

Overloading existing conventions of that valid identifier with this
special construct is too much, in my view.

> Even though ``:`` could theoretically denote implicit lambda, it's too
> easy to miss it. The combination ``_:`` is much easier to notice.

I disagree; it is too easy to miss.

 \        “Last year I went fishing with Salvador Dali. He was using a |
  `\          dotted line. He caught every other fish.” —Steven Wright |
_o__)                                                                  |
Ben Finney

More information about the Python-ideas mailing list