Re: [Python-ideas] A simple proposal concerning lambda

2018-08-23 Thread Stephan Houben
Op do 23 aug. 2018 09:06 schreef Jacco van Dorp : > I think it would have been better to use def from the start instead of > lambda. The only thing JS does right is using the same "function" keyword > for both of these. > Seriously? Consider how the following code function f() { return 42; }

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-23 Thread Jacco van Dorp
I think it would have been better to use def from the start instead of lambda. The only thing JS does right is using the same "function" keyword for both of these. However, changing it now doesn't seem that important to me. (And I've used lambda's as default argument - I was moving data from one

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-22 Thread Rhodri James
On 22/08/18 17:59, Chris Barker via Python-ideas wrote: On Wed, Aug 22, 2018 at 9:51 AM, Stephan Houben wrote: Let me stand up and say that I personally like lambda. It's the standard terminology and not easily confused. I agree. And secondly, even if I didn't like it, changing the name of

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-22 Thread Steven D'Aprano
On Tue, Aug 21, 2018 at 09:57:51PM -0500, Abe Dillon wrote: > [Chris Angelico] > > > If you have a use-case for a lambda function that takes a callback and > > has a default value for that callback, please submit it to The Daily > > WTF. In Steve's example, the main function was created with a >

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-22 Thread Steven D'Aprano
On Wed, Aug 22, 2018 at 04:58:17PM +0100, Jonathan Fine wrote: > I wrote: > > > Here is my simple proposal. Enhance Python to allow > > > > >>> hn = def a, b=2, c=3: a ** b / c > > I'd like to add a clarification. Here are two proposals. > > ONE. Wherever you could have used 'lambda', you now

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-22 Thread Chris Barker via Python-ideas
On Wed, Aug 22, 2018 at 9:51 AM, Stephan Houben wrote: > Let me stand up and say that I personally like lambda. It's the standard > terminology and not easily confused. > I agree. And secondly, even if I didn't like it, changing the name of something because it's a slightly less confusing name

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-22 Thread Stephan Houben
Let me stand up and say that I personally like lambda. It's the standard terminology and not easily confused. I doubt that "many Python users" have a problem with it. Evidence? I dislike the def proposal strongly. It is too similar to a normal def. At least get a new keyword then Some other

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-22 Thread Brice Parent
Le 22/08/2018 à 04:12, MRAB a écrit : On 2018-08-22 02:38, Elazar wrote: I don't think this change makes sense, but if it's done, there should be another change, with actual implications: There is no way to express the types of the parameters in a lambda - `lambda x: int : x` is obviously a

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-22 Thread Mike Miller
I've often thought the same about "lambda." Although I've long since gotten used to the word, "def" without a function name seemed like a better choice, especially for beginners. +0.25 for proposal ONE However, parentheses should be allowed and lambda put on a long deprecation schedule.

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-22 Thread Jonathan Fine
I wrote: > Here is my simple proposal. Enhance Python to allow > > >>> hn = def a, b=2, c=3: a ** b / c I'd like to add a clarification. Here are two proposals. ONE. Wherever you could have used 'lambda', you now have a choice. You can still use 'lambda', or you can use 'def' instead. The

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-21 Thread Abe Dillon
[Chris Angelico] > Though... it's insignificant when the function header precedes the > expression/body. With the proposal to move the header to the end, that > might become problematic, which makes it yet another cost to the > proposal. I don't think it would be a problem because, like ternary

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-21 Thread Chris Angelico
On Wed, Aug 22, 2018 at 12:57 PM, Abe Dillon wrote: > [Chris Angelico] >> >> If you have a use-case for a lambda function that takes a callback and >> has a default value for that callback, please submit it to The Daily >> WTF. In Steve's example, the main function was created with a >>

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-21 Thread Abe Dillon
[Chris Angelico] > If you have a use-case for a lambda function that takes a callback and > has a default value for that callback, please submit it to The Daily > WTF. In Steve's example, the main function was created with a > statement. Fair enough, but I still think D'Aprano may have

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-21 Thread Chris Angelico
On Wed, Aug 22, 2018 at 12:48 PM, Abe Dillon wrote: > [Steven D'Aprano] >> >> Replacing the keyword: >> results = map(def a, b=2, c=3: a ** b / c, sequence) >> widget.register(callback=def: spam.eggs()) >> Doesn't look so attractive now, I wager. Using "def" inside an >> expression looks

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-21 Thread Abe Dillon
[Steven D'Aprano] > most importantly, "def" with "fun", which will have the > advantage of making Python programming more fun! I'm sold. Make the change and SHIP IT! No need for committee approval. [Steven D'Aprano] > If we're going to break people's code by > changing keywords, let's do it

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-21 Thread MRAB
On 2018-08-22 02:38, Elazar wrote: I don't think this change makes sense, but if it's done, there should be another change, with actual implications: There is no way to express the types of the parameters in a lambda - `lambda x: int : x` is obviously a syntax error. Replacing the colon with a

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-21 Thread Abe Dillon
[Jonathan Fine] > one of the messages had a link to still live and excellent page > > https://wiki.python.org/moin/AlternateLambdaSyntax > This page lists over 100 suggestions, mostly variants. So far as I can > see, my simple proposal isn't listed on that page. The page also says Awesome!

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-21 Thread Stephen J. Turnbull
Abe Dillon writes: > What I've found so far is this unreassuring post from Guido back in > 2006 > IIRC, early drafts of PEP 3000 (the PEP that was the planning document for the Python 3 project) removed lambda

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-21 Thread Steven D'Aprano
On Tue, Aug 21, 2018 at 10:27:20PM +0100, Jonathan Fine wrote: > Here is my simple proposal. Enhance Python to allow > > >>> hn = def a, b=2, c=3: a ** b / c Enhancements ought to allow us to write new code that we couldn't do before, or open up new kinds of algorithms that weren't easy or

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-21 Thread Elazar
I don't think this change makes sense, but if it's done, there should be another change, with actual implications: There is no way to express the types of the parameters in a lambda - `lambda x: int : x` is obviously a syntax error. Replacing the colon with a different symbol, such as "=>" will

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-21 Thread MRAB
On 2018-08-22 01:25, Jonathan Fine wrote: Hi Abe Summary: You've done good work here. I've skim read the 2006 discussion you found. You wrote: I'm trying to dig up past threads about alternatives to lambda because I would be astonished if "def" hadn't been considered and rejected for some

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-21 Thread Jonathan Fine
Hi Abe Summary: You've done good work here. I've skim read the 2006 discussion you found. You wrote: > I'm trying to dig up past threads about alternatives to lambda because I > would be astonished if "def" hadn't been considered and rejected for some > reason. What I've found so far is this

Re: [Python-ideas] A simple proposal concerning lambda

2018-08-21 Thread Abe Dillon
I'm trying to dig up past threads about alternatives to lambda because I would be astonished if "def" hadn't been considered and rejected for some reason. What I've found so far is this unreassuring post from Guido back in 2006

[Python-ideas] A simple proposal concerning lambda

2018-08-21 Thread Jonathan Fine
Here's what I call a simple proposal. Some people might find it outrageous. Today is not 1st April. BACKGROUND Many Python users don't like the name lambda. But many Python users don't want any change here. This is true because there are millions of Python users, and even 100 is