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

2020-11-26 Thread Tobias Kohn
Hi Koos, Yes, our three PEPs (634/635/636) are up to date.  PEP 634 is the technical specification, so you probably want to start with the tutorial (PEP 636) or the rationale (PEP 635). https://www.python.org/dev/peps/pep-0636/ https://www.python.org/dev/peps/pep-0635/ Perhaps the followi

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

2020-11-26 Thread Koos Zevenhoven
I've had some things going on, and I'm still 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 int

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

2020-11-22 Thread Jim J. Jewett
I suppose that does follow from treating _ specially by not binding to it at all; I just hadn't thought through it. (I think my mental model had it wiping out the previous binding even if the "new" one wasn't available.) So I would prefer that this be stated explicitly in the PEP. (And maybe

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

2020-11-20 Thread Guido van Rossum
On Wed, Nov 18, 2020 at 11:39 AM Brett Cannon wrote: > Now obviously "practicality beats purity" as well, but the argument "other > languages do it this way" doesn't hold well for a language that doesn't use > curly braces for scoping delineation. 😉 > I see your smiley, and I believe I've addres

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

2020-11-20 Thread Tobias Kohn
Hi Brett, Thanks for your replies. _> But you can write `123 .bit_length()`. 😊 That's a parser limitation more than human understanding._ Touché.  I took this ambiguity of the dot so much for granted that I would not have thought of trying that. _> Yep, but PEP 634 not only changes the

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

2020-11-20 Thread Guido van Rossum
But none of those limitations are there under our proposal. You can write this if you want: match = 1 match match: case case: print(case, match) And you can use _(“...”) anywhere in the case block and even in the guard. Just not as a pattern, but you can’t use f(1) there either... On Fri,

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

2020-11-20 Thread Jim J. Jewett
Not being able to use a particular variable name (such as match or case) in the limited context of matching is only a minor wart. Unfortunately, _ for internationalization is already a well-established convention for something that you might well want to do within each separate case. It isn't

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

2020-11-19 Thread Daniel Moisset
A notorious example here of the "not many" is this proposal (i.e. not part of the language yet) for C++: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1371r0.pdf . I think it's an interesting example given that this is a very mature language, not originally designed with pattern matching

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

2020-11-18 Thread Guido van Rossum
On Wed, Nov 18, 2020 at 11:39 AM Brett Cannon wrote: > My question about adding pattern matching later was more to comment on the > fact that the languages that use "_" for a wildcard pattern did it from > early on, not later on; it had nothing to do with the proposal proposing > pattern matching

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

2020-11-18 Thread Brett Cannon
On Tue, Nov 17, 2020 at 1:16 PM Tobias Kohn wrote: > Hi Brett, > > Without having really looked at the history of all the languages we > mention in the PEPs, I have a hunch that most of them had pattern matching > from quite the beginning or an early stage on, indeed. That being said, I > think

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

2020-11-17 Thread Tobias Kohn
Hi Brett, Without having really looked at the history of all the languages we mention in the PEPs, I have a hunch that most of them had pattern matching from quite the beginning or an early stage on, indeed.  That being said, I think the question itself does not really make much sense, t

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

2020-11-17 Thread Brett Cannon
On Mon, Nov 16, 2020 at 9:03 AM Tobias Kohn wrote: > 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 somew

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

2020-11-16 Thread Terry Reedy
On 11/16/2020 11:57 AM, Tobias Kohn wrote: 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 (as a side note: int

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

2020-11-16 Thread Terry Reedy
On 11/16/2020 6:14 AM, Mark Shannon wrote: 2. Is the error in the ast matching example, an intentional "simplification" or just an oversight? The example: ``` def simplify(node):     match node:     case BinOp(Num(left), '+', Num(right)):     return Num(left + right)     c

[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 (a