[Python-ideas] Pattern Matching -- Removing Name Binding from Partial Matching

2021-02-12 Thread Abdulla Al Kathiri
I will explain it in the following few lines of code.. name = "George" year = 2021 d = {"name": "Mike", "year": 1919} match d: case {"name": name, "year": 1917}: print("match 1 found”) # I want to remove binding "name" here from partial matching

[Python-ideas] Re: Alternate lambda syntax

2021-02-12 Thread Andy Challis
Did you mean this Paul? (a, b) >= (1, 2) ___ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://m

[Python-ideas] Re: Alternate lambda syntax

2021-02-12 Thread Paul Moore
Fair enough. Whoever writes a PEP for this will need to do the relevant research and present the arguments in detail. But until someone's ready to write that PEP, we can continue discussing on the assumption that if someone finds the async version useful, they'll speak up. Paul On Fri, 12 Feb 202

[Python-ideas] Re: Alternate lambda syntax

2021-02-12 Thread Abdulla Al Kathiri
I am not that familiar with asyncio either. I only wrote a few utility scripts that runs concurrent subprocesses mixed with some blocking functions running in concurrent.ProcessPoolExecutor pool (using asyncio.run_in_executor). That is all what I did with regard asyncio. Your function f2 and my

[Python-ideas] Re: Alternate lambda syntax

2021-02-12 Thread Chris Angelico
On Fri, Feb 12, 2021 at 7:57 PM Brendan Barnwell wrote: > > On 2021-02-11 03:24, J. Pic wrote: > > Hi all, > > > > Lambdas can be defined as such: > > > > w = lambda: [12] > > x = lambda y: len(y) > > > > I'd like to propose the following: > > > > w = (): [12] > > x = (y): len(y) > > > > Or even a

[Python-ideas] Re: Conditional with statements

2021-02-12 Thread Rob Cliffe via Python-ideas
On 08/02/2021 00:39, Brendan Barnwell wrote: On 2021-02-07 09:59, Christopher Barker wrote: All that being said, it's not that big a deal, and I personally don't try to limit to 80 chars per line anyway -- preferring 90 or 95 -- I haven't used a VT100 in decades To be honest I find

[Python-ideas] Re: Alternate lambda syntax

2021-02-12 Thread Paul Moore
On Fri, 12 Feb 2021 at 09:26, Abdulla Al Kathiri wrote: > > I actually like the “(x, y=7) => x + y” and “async (x, y) => asyncio.sleep(x > + y)” for both normal and async anonymous functions respectfully. I think it's a reasonable syntax, although it could be over-used. That's not an issue with

[Python-ideas] Re: Alternate lambda syntax

2021-02-12 Thread Abdulla Al Kathiri
I actually like the “(x, y=7) => x + y” and “async (x, y) => asyncio.sleep(x + y)” for both normal and async anonymous functions respectfully. I have natural aversion to the word lambda for some reason. The normal anon function has “return” implicitly, and the async anon function has “return” im

[Python-ideas] Re: Alternate lambda syntax

2021-02-12 Thread Brendan Barnwell
On 2021-02-11 03:24, J. Pic wrote: Hi all, Lambdas can be defined as such: w = lambda: [12] x = lambda y: len(y) I'd like to propose the following: w = (): [12] x = (y): len(y) Or even another contraction for when there are no arguments: w =: [12] I don't see any need for this. It's eve