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

Matt Gilson matt at getpattern.com
Wed Jul 13 03:30:24 EDT 2016


On Tue, Jul 12, 2016 at 11:56 PM, Pavol Lisy <pavol.lisy at gmail.com> wrote:

> On 7/13/16, Ben Finney <ben+python at benfinney.id.au> wrote:
> > Pavol Lisy <pavol.lisy at gmail.com> writes:
> >
> >> Questions around "only one possibilities how to write it" could be
> >> probably answered with this?
> >>
> >>   a<b
> >>   a.__lt__(b)
> >
> > The maxim is not “only one way”. That is a common misconception, but it
> > is easily dispelled: read the Zen of Python (by ‘import this’ in the
> > interactive prompt).
> >
> > Rather, the maxim is “There should be one obvious way to do it”, with a
> > parenthetical “and preferably only one”.
> >
> > So the emphasis is on the way being *obvious*, and all other ways being
> > non-obvious. This leads, of course, to choosing the best way to also be
> > the one obvious way to do it.
> >
> > Your example above supports this: the comparison ‘a < b’ is the one
> > obvious way to compare whether ‘a’ is less than ‘b’.
> >
> > --
> >  \       “It is forbidden to steal hotel towels. Please if you are not |
> >   `\          person to do such is please not to read notice.” —hotel, |
> > _o__)                                               Kowloon, Hong Kong |
> > Ben Finney
> >
> > _______________________________________________
> > Python-ideas mailing list
> > Python-ideas at python.org
> > https://mail.python.org/mailman/listinfo/python-ideas
> > Code of Conduct: http://python.org/psf/codeofconduct/
>
> I don't support this lambda proposal (in this moment - but probably
> somebody could convince me).
>
>
I don't either, but I'm glad it was brought up regardless...


> But if we will accept it then Unicode version could be the obvious one
> couldn't be?
>

I certainly hope not.  As a user with no lambda key on my keyboard, the
only way that I know to input one is to do a google search for "unicode
greek letter lambda" and copy/paste one of those characters into my editor
:-).

FWIW, I think that the cons here far outweigh the pros -- As a former
physicist, when I see a lambda character, I immediately think of a whole
host of things (wavelength!) and none of them is "anonymous function".
Perhaps someone who works more with lambda calculus (or with a more
rigorous comp-sci background) would disagree -- but my point is that this
notation would possibly only serve a small community -- and it could
possibly break code for another small group of users who are using lambdas
as variable names to be clever (which is another practice that I wouldn't
support...) and finally, I think it might just be confusing for other
people (1-character non-ascii keywords?  If my editor's syntax definition
wasn't up-to-date, I'd definitely expect a `SyntaxError` from that).

All of that aside, it seems like the pros that the original poster
mentioned could be gained by writing a plugin for your editor that makes
the swap on save and load.  Apparently this already exists for some editors
-- Why risk breaking existing code to add a syntax that can be handled by
an editor extension?



> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>



-- 

[image: pattern-sig.png]

Matt Gilson // SOFTWARE ENGINEER

E: matt at getpattern.com // P: 603.892.7736

We’re looking for beta testers.  Go here
<https://www.getpattern.com/meetpattern> to sign up!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160713/b3c4eb7a/attachment.html>


More information about the Python-ideas mailing list