[Python-ideas] allow `lambda' to be spelled λ

Ben Finney ben+python at benfinney.id.au
Tue Jul 12 19:46:37 EDT 2016


Stephan Houben <stephanh42 at gmail.com>
writes:

> Here is my speculative language idea for Python:

Thank you for raising it.

> Allow the following alternative spelling of the keyword `lambda':
> λ
> […]

> Therefore I would really like this to be an official part of the
> Python syntax.
>
> I know people have been clamoring for shorter lambda-syntax in the
> past, I think this is a nice minimal extension.

The question is not whether it would be nice, nor how many people have
clamoured for it. That you feel this supports the proposal isn't a good
sign :-)

The question is: What significant improvements to the language are made
by this proposal, to counteract the significant cost of *any* such
change to the language syntax?

> Advantages:
>
> * The lambda keyword is quite long and distracts from the "meat" of
>   the lambda expression. Replacing it by a single-character keyword
>   improves readability.

I disagree on this point. Making lambda easier is an attractive
nuisance; the ‘def’ statement is superior (for Python) in most
situations, and so lamda expressions should not be easier than that.

> * The resulting code resembles more closely mathematical notation (in
>   particular, lambda-calculus notation), so it brings Python closer to
>   being "executable pseudo-code".

How is that an advantage?

> * The alternative spelling λ/lambda is quite intuitive (at least to
>   anybody who knows Greek letters.)

I reject this use of “intuitive; no one knows intuitively what lambda
is, what λ is, what the correspondence between them is, and what they
mean in various contexts. All of that needs to be learned, specifically.

so if this is an advantage, it needs to be expressed somehow other than
“intuitive”. Maybe you mean “familiar”, and avoid that term because it
makes for a weaker argument?

> Disadvantages:

I agree with your assessment of disadvantages, and re-iterate the
inherent disadvantage that any language change brings significant cost
to the Python core developers and the whole Python community. That's why
most such suggestions have a significant hurdle to demonstrate a
benefit.

-- 
 \           “Prediction is very difficult, especially of the future.” |
  `\                                                       —Niels Bohr |
_o__)                                                                  |
Ben Finney



More information about the Python-ideas mailing list