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

אלעזר elazarg at gmail.com
Thu Jul 14 10:19:35 EDT 2016


`def` is a much more readable alternative, which will be more familiar to
newcomers. The expression/block ambiguity can be resolved using different
token instead of colon (perhaps := or an arrow).
I can't understand the reaching for the Greek letter - it is a
computer-science specific term with no intuitive meaning.

On Thu, Jul 14, 2016 at 4:49 PM <python-ideas-request at python.org> wrote:

> Send Python-ideas mailing list submissions to
>         python-ideas at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://mail.python.org/mailman/listinfo/python-ideas
> or, via email, send a message with subject or body 'help' to
>         python-ideas-request at python.org
>
> You can reach the person managing the list at
>         python-ideas-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Python-ideas digest..."
>
>
> Today's Topics:
>
>    1. Re:  allow `lambda' to be spelled ? (David Mertz)
>    2. Re: Use unbound bytes methods with objects supporting the
>       buffer protocol (Nick Coghlan)
>    3. Re:  allow `lambda' to be spelled ? (Random832)
>    4. Re:  allow `lambda' to be spelled ? (SW)
>    5. Re:  allow `lambda' to be spelled ? (Chris Angelico)
>    6. Re:  allow `lambda' to be spelled ? (SW)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Wed, 13 Jul 2016 23:39:26 -0700
> From: David Mertz <mertz at gnosis.cx>
> To: "Steven D'Aprano" <steve at pearwood.info>
> Cc: python-ideas <python-ideas at python.org>
> Subject: Re: [Python-ideas]  allow `lambda' to be spelled ?
> Message-ID:
>         <
> CAEbHw4aVKCXLu2DC7K6ArxVHAjOkc15yk+irtPKfBa5xEy0G2A at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> On Wed, Jul 13, 2016 at 7:44 PM, Steven D'Aprano <steve at pearwood.info>
> wrote:
>
> > - suppose that reading ? has a *tiny* benefit of 1% over "lambda"
> >   (for those who have learned what it means);
> > - but typing it is (lets say) 50 times harder than typing "lambda";
> > - but we read code 50 times as often as we type it;
> > - so the total benefit (50*1.01 - 50) is positive.
>
>
> I actually *do* think ? is a little bit more readable.  And I have no idea
> how to type it directly on my El Capitan system with the ABC Extended
> keyboard.  But I still get 100% of the benefit in readability simply by
> using vim's conceal feature.  If I used a different editor I'd have to hope
> for a similar feature (or program it myself), but this is purely a display
> question.  Similarly, I think syntax highlighting makes my code much more
> readable, but I don't want colors for keywords built into the language.
> That is, and should remain, a matter of tooling not core language (I don't
> want https://en.wikipedia.org/wiki/ColorForth for Python).
>
> FWIW, my conceal configuration is at link I give in a moment.  I've
> customized a bunch of special stuff besides lambda, take it or leave it:
>
>   http://gnosis.cx/bin/.vim/after/syntax/python.vim
>
> --
> Keeping medicines from the bloodstreams of the sick; food
> from the bellies of the hungry; books from the hands of the
> uneducated; technology from the underdeveloped; and putting
> advocates of freedom in prisons.  Intellectual property is
> to the 21st century what the slave trade was to the 16th.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> http://mail.python.org/pipermail/python-ideas/attachments/20160713/8fafff3f/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 2
> Date: Thu, 14 Jul 2016 18:52:19 +1000
> From: Nick Coghlan <ncoghlan at gmail.com>
> To: Terry Reedy <tjreedy at udel.edu>
> Cc: "python-ideas at python.org" <python-ideas at python.org>
> Subject: Re: [Python-ideas] Use unbound bytes methods with objects
>         supporting the buffer protocol
> Message-ID:
>         <CADiSq7fBqm9HHjVUrHhq=
> H_DGLZAp2LhgWiWwj97N7Wt31eEEw at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> On 14 July 2016 at 07:09, Terry Reedy <tjreedy at udel.edu> wrote:
> > Assuming that the descriptor check is not just an unintened holdover from
> > 2.x, it seems that for C-coded functions used as methods, type-checking
> the
> > first arg was conceptually factored out and replaced by a generic check
> in
> > the descriptor mechanism.
>
> It's intentional - the default C level descriptors typecheck their
> first argument, since getting that wrong may cause a segfault in most
> cases.
>
> > If the descriptor check cannot be selectively loosened, a possible
> solution
> > might be a base class for all bytes-like buffer protocol classes that
> would
> > have all method functions that work with all bytes-like objects.
>
> A custom wrapper descriptor that checks for "supports the buffer
> protocol" rather than "is a bytes-like object" is certainly possible,
> so I believe Serhiy's question here is more a design question around
> "Should they?" than it is a technical question around "Can they?".
>
> Given the way this would behave if "bytes" was implemented in Python
> rather than C (i.e. unbound methods would rely on ducktyping, even for
> the first argument), +1 from me for making the unbound methods for
> bytes compatible with arbitrary objects supporting the buffer
> protocol.
>
> Cheers,
> Nick.
>
> --
> Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
>
>
> ------------------------------
>
> Message: 3
> Date: Thu, 14 Jul 2016 09:10:44 -0400
> From: Random832 <random832 at fastmail.com>
> To: python-ideas at python.org
> Subject: Re: [Python-ideas]  allow `lambda' to be spelled ?
> Message-ID:
>         <1468501844.2375597.666170897.1B915C53 at webmail.messagingengine.com
> >
> Content-Type: text/plain
>
> On Tue, Jul 12, 2016, at 09:42, Random832 wrote:
> > On Tue, Jul 12, 2016, at 08:38, Stephan Houben wrote:
> > > I know people have been clamoring for shorter lambda-syntax in the
> > > past, I think this is a nice minimal extension.
> >
> > How about a haskell-style backslash?
>
> Nobody has any thoughts at all?
>
>
> ------------------------------
>
> Message: 4
> Date: Thu, 14 Jul 2016 14:22:06 +0100
> From: SW <walker_s at hotmail.co.uk>
> To: python-ideas at python.org
> Subject: Re: [Python-ideas]  allow `lambda' to be spelled ?
> Message-ID: <BLU437-SMTP30F3DA885E8338C19B8620B8320 at phx.gbl>
> Content-Type: text/plain; charset="windows-1252"
>
> To me the backslash already has a fairly strong association with "the
> next character is a literal". Overloading it would feel very strange.
>
> S
>
> On 14/07/16 14:10, Random832 wrote:
> > On Tue, Jul 12, 2016, at 09:42, Random832 wrote:
> >> On Tue, Jul 12, 2016, at 08:38, Stephan Houben wrote:
> >>> I know people have been clamoring for shorter lambda-syntax in the
> >>> past, I think this is a nice minimal extension.
> >> How about a haskell-style backslash?
> > Nobody has any thoughts at all?
> > _______________________________________________
> > 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/
> >
> >
>
>
>
> ------------------------------
>
> Message: 5
> Date: Thu, 14 Jul 2016 23:27:35 +1000
> From: Chris Angelico <rosuav at gmail.com>
> Cc: python-ideas <python-ideas at python.org>
> Subject: Re: [Python-ideas]  allow `lambda' to be spelled ?
> Message-ID:
>         <
> CAPTjJmqn6RK7FuW9s2+K_t2riYSi3Rpigx5CdUOV6228PV5VTQ at mail.gmail.com>
> Content-Type: text/plain; charset=UTF-8
>
> On Thu, Jul 14, 2016 at 11:22 PM, SW <walker_s at hotmail.co.uk> wrote:
> > To me the backslash already has a fairly strong association with "the
> > next character is a literal". Overloading it would feel very strange.
>
> But it also has the meaning of "the next character is special", such
> as \n for newline or \uNNNN for a Unicode escape. However, I suspect
> there might be a parsing conflict:
>
> do_stuff(stuff_with_long_name, more_stuff, what_is_next_arg, \
>
> At that point in the parsing, are you looking at a lambda function or
> a line continuation? Sure, style guides would decry this (put the
> backslash with its function, dummy!), but the parser can't depend on
> style guides being followed.
>
> -1 on using backslash for this.
> -0 on ?.
>
> ChrisA
>
>
> ------------------------------
>
> Message: 6
> Date: Thu, 14 Jul 2016 14:49:04 +0100
> From: SW <walker_s at hotmail.co.uk>
> To: python-ideas at python.org
> Subject: Re: [Python-ideas]  allow `lambda' to be spelled ?
> Message-ID: <BLU436-SMTP6869F6B764D38844571E1CB8320 at phx.gbl>
> Content-Type: text/plain; charset="utf-8"
>
> Ah, yes, sorry- it certainly holds that meaning to me as well. I agree
> with your stated views on this (and ratings):
>
> -1 on using backslash for this.
> -0 on ?.
>
> Thanks,
> S
>
> On 14/07/16 14:27, Chris Angelico wrote:
> > On Thu, Jul 14, 2016 at 11:22 PM, SW <walker_s at hotmail.co.uk> wrote:
> >> To me the backslash already has a fairly strong association with "the
> >> next character is a literal". Overloading it would feel very strange.
> > But it also has the meaning of "the next character is special", such
> > as \n for newline or \uNNNN for a Unicode escape. However, I suspect
> > there might be a parsing conflict:
> >
> > do_stuff(stuff_with_long_name, more_stuff, what_is_next_arg, \
> >
> > At that point in the parsing, are you looking at a lambda function or
> > a line continuation? Sure, style guides would decry this (put the
> > backslash with its function, dummy!), but the parser can't depend on
> > style guides being followed.
> >
> > -1 on using backslash for this.
> > -0 on ?.
> >
> > ChrisA
> > _______________________________________________
> > 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/
>
>
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
>
>
> ------------------------------
>
> End of Python-ideas Digest, Vol 116, Issue 28
> *********************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160714/3a2a434a/attachment-0001.html>


More information about the Python-ideas mailing list