Let's just *keep* lambda

classic Classic list List threaded Threaded
66 messages Options
1234
Reply | Threaded
Open this post in threaded view
|

Let's just *keep* lambda

Guido van Rossum
After so many attempts to come up with an alternative for lambda,
perhaps we should admit defeat. I've not had the time to follow the
most recent rounds, but I propose that we keep lambda, so as to stop
wasting everybody's talent and time on an impossible quest.

--
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

Gary Herron
Guido van Rossum wrote:

>After so many attempts to come up with an alternative for lambda,
>perhaps we should admit defeat. I've not had the time to follow the
>most recent rounds, but I propose that we keep lambda, so as to stop
>wasting everybody's talent and time on an impossible quest.
>
>--
>--Guido van Rossum (home page: http://www.python.org/~guido/)
>_______________________________________________
>Python-Dev mailing list
>[hidden email]
>http://mail.python.org/mailman/listinfo/python-dev
>Unsubscribe: http://mail.python.org/mailman/options/python-dev/gherron%40islandtraining.com
>  
>
Hear hear!

+1

Gary Herron
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

Xavier Morel
In reply to this post by Guido van Rossum
Guido van Rossum wrote:
> After so many attempts to come up with an alternative for lambda,
> perhaps we should admit defeat. I've not had the time to follow the
> most recent rounds, but I propose that we keep lambda, so as to stop
> wasting everybody's talent and time on an impossible quest.
>
The inline anonymous `def` isn't as ugly/problematic as the block (block
anonymous def) version, and could probably work better than lambda, I
think (a bit more verbose, but at least it doesn't feel like a castrated
function definition, is more coherent with the existing function
definition syntax, and accepts more than a single statement... well that
last part probably isn't a pro arguments...).

Couldn't it be enabled (as an inline construct only) to replace the
current lambda?
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

Terry Reedy
In reply to this post by Guido van Rossum

"Guido van Rossum" <[hidden email]> wrote in message
news:[hidden email]...
> After so many attempts to come up with an alternative for lambda,
> perhaps we should admit defeat. I've not had the time to follow the
> most recent rounds, but I propose that we keep lambda, so as to stop
> wasting everybody's talent and time on an impossible quest.

To me, there are two separate issues: the keyword and the syntax.  I also
have not been impressed by any of the numerous alternative syntaxes
proposed over several years and just this morning was thinking something
similar to the above.

But will you consider changing the keyword from the charged and overladen
'lambda' to something else?  (See other post today.)  I think this would
cut at least half the fuss.

I base this on the following observation: generator expressions are to
generator statement definitions much like function expressions are to
function statement definitions.  Both work when the payload yielded or
returned is computed in a single expression.  But I personally have not
seen any complaints about the 'limitations of generator expressions' nor
proposals to duplicate the generality of statement definitions by stuffing
compound statement bodies within expressions.

But if we had called them generator lambdas, I suspect we would have.

Terry Jan Reedy



_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

Fred Drake-3
In reply to this post by Guido van Rossum
On Sunday 05 February 2006 12:43, Guido van Rossum wrote:
 > After so many attempts to come up with an alternative for lambda,
 > perhaps we should admit defeat. I've not had the time to follow the
 > most recent rounds, but I propose that we keep lambda, so as to stop
 > wasting everybody's talent and time on an impossible quest.

+1


  -Fred

--
Fred L. Drake, Jr.   <fdrake at acm.org>
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

Paul Moore
In reply to this post by Guido van Rossum
On 2/5/06, Guido van Rossum <[hidden email]> wrote:
> After so many attempts to come up with an alternative for lambda,
> perhaps we should admit defeat. I've not had the time to follow the
> most recent rounds, but I propose that we keep lambda, so as to stop
> wasting everybody's talent and time on an impossible quest.

+1

The recently suggested keyword change, from lambda to expr (as in
'''expr x, y: x+y''') looks like an improvement to me, but I suspect
opening up the possibility of a keyword change would simply restart
all the discussions... (Nevertheless, I'd be +1 on lambda being
renamed to expr, if it was an option).

Paul.
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

Raymond Hettinger-2
In reply to this post by Guido van Rossum
> After so many attempts to come up with an alternative for lambda,
> perhaps we should admit defeat. I've not had the time to follow the
> most recent rounds, but I propose that we keep lambda, so as to stop
> wasting everybody's talent and time on an impossible quest.

+1 -- trying to cover all the use cases is a fools errand

Raymond
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

Dennis Allison
In reply to this post by Paul Moore

+1 on retaining lambda
-1 on any name change


On Sun, 5 Feb 2006, Paul Moore wrote:

> On 2/5/06, Guido van Rossum <[hidden email]> wrote:
> > After so many attempts to come up with an alternative for lambda,
> > perhaps we should admit defeat. I've not had the time to follow the
> > most recent rounds, but I propose that we keep lambda, so as to stop
> > wasting everybody's talent and time on an impossible quest.
>
> +1
>
> The recently suggested keyword change, from lambda to expr (as in
> '''expr x, y: x+y''') looks like an improvement to me, but I suspect
> opening up the possibility of a keyword change would simply restart
> all the discussions... (Nevertheless, I'd be +1 on lambda being
> renamed to expr, if it was an option).
>
> Paul.
> _______________________________________________
> Python-Dev mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/allison%40shasta.stanford.edu
>

--

_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

Crutcher  Dunnavant
In reply to this post by Guido van Rossum
+1

On 2/5/06, Guido van Rossum <[hidden email]> wrote:

> After so many attempts to come up with an alternative for lambda,
> perhaps we should admit defeat. I've not had the time to follow the
> most recent rounds, but I propose that we keep lambda, so as to stop
> wasting everybody's talent and time on an impossible quest.
>
> --
> --Guido van Rossum (home page: http://www.python.org/~guido/)
> _______________________________________________
> Python-Dev mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/crutcher%40gmail.com
>


--
Crutcher Dunnavant <[hidden email]>
monket.samedi-studios.com
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

Tim Peters
In reply to this post by Guido van Rossum
[Guido]
> After so many attempts to come up with an alternative for lambda,
> perhaps we should admit defeat. I've not had the time to follow the
> most recent rounds, but I propose that we keep lambda, so as to stop
> wasting everybody's talent and time on an impossible quest.

Huh!  Was someone bad-mouthing lambda again?  We should keep it, but
rename it to honor a different Greek letter.  xi is a good one, easier
to type, and would lay solid groundwork for future flamewars between
xi enthusiasts and Roman numeral fans :-)
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

Crutcher  Dunnavant
Which reminds me, we need to support roman numeral constants.
A silly implementation follows.

class RomanNumeralDict(dict):
  def __getitem__(self, key):
    if not self.has_key(key) and self.isRN(key):
      return self.decodeRN(key)
    return dict.__getitem__(self, key)

  def isRN(self, key):
    for c in key:
      if c not in 'MmCcXxIiDdVv':
        return False
    return True

  def decodeRN(self, key):
    val = 0
    # ... do stuff ...
    return val

On 2/5/06, Tim Peters <[hidden email]> wrote:

> [Guido]
> > After so many attempts to come up with an alternative for lambda,
> > perhaps we should admit defeat. I've not had the time to follow the
> > most recent rounds, but I propose that we keep lambda, so as to stop
> > wasting everybody's talent and time on an impossible quest.
>
> Huh!  Was someone bad-mouthing lambda again?  We should keep it, but
> rename it to honor a different Greek letter.  xi is a good one, easier
> to type, and would lay solid groundwork for future flamewars between
> xi enthusiasts and Roman numeral fans :-)
> _______________________________________________
> Python-Dev mailing list
> [hidden email]
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: http://mail.python.org/mailman/options/python-dev/crutcher%40gmail.com
>


--
Crutcher Dunnavant <[hidden email]>
monket.samedi-studios.com
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

Tim Peters
[Crutcher Dunnavant[
> Which reminds me, we need to support roman numeral constants.

One of my more-normal relatives reminded me that this is Super Bowl XL
Sunday, so your demand is more topical than it would ordinarily be.
Alas, there's already a PEP on this, and it was already rejected.  See
PEP CCCXIII:

    http://www.python.org/peps/pep-0313.html
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

Eric Nieuwland
In reply to this post by Guido van Rossum
On 5 feb 2006, at 18:43, Guido van Rossum wrote:

> After so many attempts to come up with an alternative for lambda,
> perhaps we should admit defeat. I've not had the time to follow the
> most recent rounds, but I propose that we keep lambda, so as to stop
> wasting everybody's talent and time on an impossible quest.
>
> --
> --Guido van Rossum (home page: http://www.python.org/~guido/)

+1

And let's add "Wise" t the BDFL's title: WBDFL. ;-)

--eric

_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

Steven Bethard
In reply to this post by Guido van Rossum
Guido van Rossum wrote:
> After so many attempts to come up with an alternative for lambda,
> perhaps we should admit defeat. I've not had the time to follow the
> most recent rounds, but I propose that we keep lambda, so as to stop
> wasting everybody's talent and time on an impossible quest.

Personally, I'd rather see a callable-from-expression syntax (the
``lambda`` expression) that looks more like our
callable-from-statements syntax (the ``def`` statement), e.g. Nick
Coghlan's def-from syntax::

    (def f(a) + o(b) - o(c) from (a, b, c))

Something like this is more consistent with how list creation is
turned into list comprehensions, how generator functions are turned
into generator expressions and how if/else statements are turned into
conditional expressions.

That said, I firmly believe that syntax decisions *must* be left to
the BDFL.  The decorator syntax and with-statement syntax debates
clearly showed this.  So if after looking at all the syntax
alternatives_, you feel that the current lambda syntax is the best we
can do, I'm willing to accept that decision.

.. _alternatives: http://wiki.python.org/moin/AlternateLambdaSyntax

STeVe
--
Grammar am for people who can't think for myself.
        --- Bucky Katt, Get Fuzzy
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

jalopyuser
In reply to this post by Guido van Rossum
> After so many attempts to come up with an alternative for lambda,
> perhaps we should admit defeat. I've not had the time to follow the
> most recent rounds, but I propose that we keep lambda, so as to stop
> wasting everybody's talent and time on an impossible quest.

+1.

This would remove my strongest objection to the current Python 3000 PEP.

Now, let's improve lambda... :-).

Bill
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

Thomas Lotze-2
In reply to this post by Steven Bethard
Steven Bethard wrote:

> Guido van Rossum wrote:
>> After so many attempts to come up with an alternative for lambda,
>> perhaps we should admit defeat. I've not had the time to follow the most
>> recent rounds, but I propose that we keep lambda, so as to stop wasting
>> everybody's talent and time on an impossible quest.

+1 for keeping the functionality, especially given list and generator
expressions being "compound lambda expressions" in a sense. Removing
anonymous functions would break a nice symmetry there.

> .. _alternatives: http://wiki.python.org/moin/AlternateLambdaSyntax

Of those, I like the "for" syntax without parens around the arguments
best: (x*y + z for x, y, z). Parentheses around the whole expression
should be optional in the same cases that allow for omitting parentheses
around generator expressions. It fits perfectly with the way generator
expression syntax relates to generator function definitions, and re-using
the "for" keyword keeps the zoo of reserved words small.

Just my 2 cents and all that...

--
Thomas


_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

Brett Cannon-2
In reply to this post by Guido van Rossum
On 2/5/06, Guido van Rossum <[hidden email]> wrote:
> After so many attempts to come up with an alternative for lambda,
> perhaps we should admit defeat. I've not had the time to follow the
> most recent rounds, but I propose that we keep lambda, so as to stop
> wasting everybody's talent and time on an impossible quest.

I have been thinking about this, and I have to say I am a little
disappointed (-0 disappointed, not -1 disappointed).  I honestly
bought the argument for removing lambda.  And I think that a deferred
object would help with one of lambda's biggest uses and made its loss
totally reasonable.

But I know that everyone and their email client is against me on this
one, so I am not going to really try to tear into this.  But I do
think that lambda needs a renaming.  Speaking as someone who still
forgets that Python's lambda is not the same as those found in
functional languages, I would much rather have it named 'expr' or
'expression' or something that is more inline with its abilities then
with a name taken for CS historical reasons.  This ain't for father's
lambda and thus shouldn't be named so.

Then again, Guido did say he "should", not that he "did" admit defeat.  =)

-Brett
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

"Martin v. Löwis"
Brett Cannon wrote:
> But I know that everyone and their email client is against me on this
> one, so I am not going to really try to tear into this.  But I do
> think that lambda needs a renaming.  Speaking as someone who still
> forgets that Python's lambda is not the same as those found in
> functional languages

Can you elaborate on that point? I feel that Python's lambda is exactly
the same as the one in Lisp. Sure, the Lisp lambda supports multiple
sequential expressions (the "progn" feature), but I understand that
this is just "an extension" (although one that has been around several
decades).

Of course, Python's expressions are much more limited as Lisp's (where
you really can have macros and special forms in as the "expression"
in a lambda), but the lambda construct itself seems to be the very
same one.

Regards,
Martin
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

Christopher Armstrong-2
On 2/7/06, "Martin v. Löwis" <[hidden email]> wrote:

> Brett Cannon wrote:
> > But I know that everyone and their email client is against me on this
> > one, so I am not going to really try to tear into this.  But I do
> > think that lambda needs a renaming.  Speaking as someone who still
> > forgets that Python's lambda is not the same as those found in
> > functional languages
>
> Can you elaborate on that point? I feel that Python's lambda is exactly
> the same as the one in Lisp. Sure, the Lisp lambda supports multiple
> sequential expressions (the "progn" feature), but I understand that
> this is just "an extension" (although one that has been around several
> decades).
>
> Of course, Python's expressions are much more limited as Lisp's (where
> you really can have macros and special forms in as the "expression"
> in a lambda), but the lambda construct itself seems to be the very
> same one.

If we phrase it somewhat differently, we can see that lambdas are
different in Python and Lisp, in a very practical way. First:
Everything in Lisp is an expression. There's no statement, in Lisp,
that isn't also an expression. Lambdas in Lisp can contain arbitrary
expressions; therefore you can put any language construct inside a
lambda. In Python, you cannot put any language construct inside a
lambda. Python's and Lisp's lambdas are effectively totally different.

+1 on keeping Lambda, +1 on making it more useful.

--
  Twisted   |  Christopher Armstrong: International Man of Twistery
   Radix    |    -- http://radix.twistedmatrix.com
            |  Release Manager, Twisted Project
  \\\V///   |    -- http://twistedmatrix.com
   |o O|    |
w----v----w-+
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
Reply | Threaded
Open this post in threaded view
|

Re: Let's just *keep* lambda

Jiwon Seo
On 2/6/06, Christopher Armstrong <[hidden email]> wrote:

> On 2/7/06, "Martin v. Löwis" <[hidden email]> wrote:
> > Brett Cannon wrote:
> > > But I know that everyone and their email client is against me on this
> > > one, so I am not going to really try to tear into this.  But I do
> > > think that lambda needs a renaming.  Speaking as someone who still
> > > forgets that Python's lambda is not the same as those found in
> > > functional languages
> >
> > Can you elaborate on that point? I feel that Python's lambda is exactly
> > the same as the one in Lisp. Sure, the Lisp lambda supports multiple
> > sequential expressions (the "progn" feature), but I understand that
> > this is just "an extension" (although one that has been around several
> > decades).
> >
> > Of course, Python's expressions are much more limited as Lisp's (where
> > you really can have macros and special forms in as the "expression"
> > in a lambda), but the lambda construct itself seems to be the very
> > same one.
>
> If we phrase it somewhat differently, we can see that lambdas are
> different in Python and Lisp, in a very practical way. First:
> Everything in Lisp is an expression. There's no statement, in Lisp,
> that isn't also an expression. Lambdas in Lisp can contain arbitrary
> expressions; therefore you can put any language construct inside a
> lambda. In Python, you cannot put any language construct inside a
> lambda. Python's and Lisp's lambdas are effectively totally different.
>
> +1 on keeping Lambda, +1 on making it more useful.

After lambda being made more useful, can I hope that I will be able to
use lambda with multiple statements? :) Lambdas in Lisp and Python are
different, but in the usability perspective they don't need to differ
too much.

-Jiwon
_______________________________________________
Python-Dev mailing list
[hidden email]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: http://mail.python.org/mailman/options/python-dev/lists%40nabble.com
1234