[Python-Dev] Re: PEP 653: Precise Semantics for Pattern Matching

2021-02-20 Thread Tobias Kohn
Hi Oscar Quoting Oscar Benjamin : On Fri, 19 Feb 2021 at 15:41, Tobias Kohn wrote: [...] It's not easy now to look back over the history of all of this. My recollection of the original version of PEP 622 (if that's the right one...) was that it had an overcomplicated protocol for __match__

[Python-Dev] Re: PEP 653: Precise Semantics for Pattern Matching

2021-02-19 Thread Tobias Kohn
Hi Mark, Quoting Mark Shannon : Hi Tobias, [...] But they are not referenced in PEP 634. I shouldn't have to trawl the internet to find the rejected ideas section. https://dl.acm.org/doi/10.1145/3426422.3426983 That paper describes a `__match__` method, which is absent from PEP 634.

[Python-Dev] Re: PEP 653: Precise Semantics for Pattern Matching

2021-02-19 Thread Tobias Kohn
Hi Mark, Quoting Mark Shannon : [...] If you had published these "more complicated, powerful protocols", you might be able to claim that this is a "rehash". But you didn't.   I would say that these ideas have been quite prominently published:

[Python-Dev] Re: PEP 653: Precise Semantics for Pattern Matching

2021-02-19 Thread Tobias Kohn
Hi Oscar, Quoting Oscar Benjamin : Yes, thanks Mark. I'm not sure I've fully understood the PEP yet but I can see some parts that I definitely like. [...] As I have just noted in my response to Mark, the aspect with the "deconstructor" (or `__match__` protocol as we called it) is

[Python-Dev] Re: PEP 653: Precise Semantics for Pattern Matching

2021-02-19 Thread Tobias Kohn
Hi Mark, Thank you for your proposal to try and have more precise semantics for pattern matching.  Of course, the proposal primarily introduces a new and extended protocol for pattern matching, upon which the 'semantics' is then based.  I think it is important to recognise and discuss

[Python-Dev] Re: Questions about about the DLS 2020

2020-11-26 Thread Tobias Kohn
trying to catch up with the discussions here. Can someone tell me what would be the best place to look at the most recent proposal? Is one of the PEPs up to date? On Mon, Nov 16, 2020 at 7:02 PM Tobias Kohn wrote: _Hi Mark, Thank you for your interest and the questions. 1

[Python-Dev] Re: The semantics of pattern matching for Python

2020-11-21 Thread Tobias Kohn
Hi David and Steve, There is hardly anything that needs to be added to your comments, of course.  However, I consider these explicitly named attributes in the class pattern to be one of the most difficult aspects of our pattern matching proposal, which is something I just want to briefly

[Python-Dev] Re: The semantics of pattern matching for Python

2020-11-21 Thread Tobias Kohn
Hi Steve, Thank you very much for your comments here.  This is certainly not the first time I feel that you not only have an excellent insight into a topic, but also manage to make your points very clearly and succinctly.  Your car example highlights the background of the proposed

[Python-Dev] Re: Questions about about the DLS 2020

2020-11-20 Thread Tobias Kohn
y Python's burden now to embark on adventures to seek out new worlds, new possibilities and boldly go where no snake has gone before... :) Kind regards, Tobias (*)  And yes, I am fully aware of assembly, purely functional languages, brainf*, etc. Quoting Brett Cannon :   On Tue,

[Python-Dev] Re: The semantics of pattern matching for Python

2020-11-20 Thread Tobias Kohn
Hi Daniel and Mark, Sorry for being slightly late to the party, but please let me add a few remarks of my own to the discussion here. 1. MUST HAVE PRECISELY DEFINED SEMANTICS Yes, there are some aspects that we left open intentionally.  Most prominently the question of how often the

[Python-Dev] Re: Questions about about the DLS 2020

2020-11-17 Thread Tobias Kohn
to your comment alone, as much more a reply to many a message and discussion that has been posted here over time. [1]  https://docs.microsoft.com/en-us/dotnet/csharp/discards Quoting Brett Cannon :   On Mon, Nov 16, 2020 at 9:03 AM Tobias Kohn wrote: _Hi Mark, Thank you

[Python-Dev] Re: Questions about about the DLS 2020

2020-11-16 Thread Tobias Kohn
Hi Mark, Thank you for your interest and the questions. 1.  This really comes down to how you look at it, or how you define pattern matching.  The issue here is that the concept of pattern matching has grown into a large and somewhat diverse flock of interpretations and implementations

[Python-Dev] Re: Pattern Matching controversy: Don't read PEP 635, read DLS'20 paper instead

2020-11-15 Thread Tobias Kohn
Hi Paul, Thank you for your comments on the DLS'20 paper.  I am glad to hear that it helps paint a clear(er) picture of pattern matching in Python.  However, please let me set the record straight in a few regards. First, there is no 'shoehorning' or 'deception' in our pattern matching

[Python-Dev] Re: My thoughts on Pattern Matching.

2020-11-09 Thread Tobias Kohn
Hi Thomas, Thank you very much for your carefully worded and thoughtful email.  I feel, however, that many of your concerns are based on an idealised picture of a future Python language that will never actually materialise. As I understand it your main point is that the concept of

[Python-Dev] Re: PEP 642: Constraint Pattern Syntax for Structural Pattern Matching

2020-10-31 Thread Tobias Kohn
Hi Nick and Everyone, We had actually considered a similar idea (i.e. load sigils) during the design phase of pattern matching. In the interest of having a rule that is as simple as possible, we had proposed to use a leading dot as a universal marker. Tin's example would thus have been

[Python-Dev] Re: PEP 622 version 2 (Structural Pattern Matching)

2020-08-04 Thread Tobias Kohn
currently on vacation. Quoting Larry Hastings :   On 7/31/20 12:36 AM, Tobias Kohn wrote: And since pattern matching is really a new feature to be introduced to Python, a feature that can be seen in different lights, there is no 'Python-Programmer intuition' that would apply in this case

[Python-Dev] Re: PEP 622 version 2 (Structural Pattern Matching)

2020-07-31 Thread Tobias Kohn
Hi Caleb, I will only answer to the second part, as the wildcard issue has been brought up and discussed time and again, and the `np` analogue is quite a stretch and far-fetched, really. One thing that stood out a bit to me as I feel to have seen it a couple of times is the question of

[Python-Dev] Re: PEP 622: Structural Pattern Matching -- followup

2020-07-26 Thread Tobias Kohn
Hi Rob, You are right: the grammar should probably read `suite` rather than `block` (i.e. the `pass` is necessary).  Thanks for catching this! As for the second question, I assume there might be a slight oversight on your part.  The last line in the example replaces the string `"_"` rather

[Python-Dev] Re: Another take on PEP 622

2020-07-19 Thread Tobias Kohn
Kind regards, Tobias Quoting Terry Reedy : On 7/16/2020 9:51 PM, Tobias Kohn wrote: Hi Everyone, I feel there are still quite a few misconceptions around concerning PEP 622 and the new pattern matching feature it proposes.  Please allow me therefore to take another attempt at explain

[Python-Dev] Re: PEP 622 aspects

2020-07-19 Thread Tobias Kohn
Hi Koos, Let me try and address some of the concerns and questions you are rising.  I am replying here to two emails of yours so as to keep traffic down. Quoting Koos Zevenhoven : > (1) Class pattern that does isinstance and nothing else. If I understand the proposed semantics

[Python-Dev] Another take on PEP 622

2020-07-16 Thread Tobias Kohn
Hi Everyone, I feel there are still quite a few misconceptions around concerning PEP 622 and the new pattern matching feature it proposes.  Please allow me therefore to take another attempt at explaining the ideas behind PEP 622 with a different approach.  Bear in mind that I naturally

[Python-Dev] Re: PEP 622 constant value syntax idea

2020-07-16 Thread Tobias Kohn
Hi Mohammad, In addition to what Rhodri James has already well pointed out, here are two additional thoughts on this. At the moment, the keyword `global` is a marker to say that the respective variable is /modified/ by a function.  Your suggestion would invert that meaning and might

[Python-Dev] Re: PEP 622 and variadic positional-only args

2020-07-16 Thread Tobias Kohn
Hi Oscar On Wed, Jul 15, 2020 at 4:41 PM Oscar Benjamin wrote: I've taken a look through PEP 622 and I've been thinking about how it could be used with sympy. Thank you very much for taking the time to carefully elaborate an interesting possible use case.  I find this very helpful and a

[Python-Dev] Re: PEP 622: Structural Pattern Matching (version 2)

2020-07-14 Thread Tobias Kohn
Hi Mark, Thank you for your message.  I might be able to answer some of the questions and also address some issues with the underlying assumptions in your email---after all, we would most certainly want to avoid discussing and reasoning about straw men, as you yourself have repeatedly