[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-18 Thread Mark Shannon
On 17/08/2020 7:39 pm, Jean Abou Samra wrote: (the example with changing HTTP_OK value is downright horrifying). As was just mentioned by Guido in another thread, there is a SyntaxWarning to alert you. That doesn't help if the symbolic constant is the last match. Also, it's only in the

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-17 Thread Jean Abou Samra
> (the example with changing HTTP_OK value is downright horrifying). As was just mentioned by Guido in another thread, there is a SyntaxWarning to alert you. > This leads to the idea that, if a special syntax if eventually used for Value > Patterns, using the comparison operator in it might

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-17 Thread Baptiste Carvello
Le 14/08/2020 à 16:24, Mark Shannon a écrit : > > https://github.com/markshannon/pep622-critique Hi all, reading through this made me think of 3 ideas which I think are new [1]. 2 of them are about the Value Pattern question, the last one is a small nit about the Django example. * the critique

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-17 Thread Guido van Rossum
On Mon, Aug 17, 2020 at 8:11 AM Mark Shannon wrote: > > > On 17/08/2020 3:08 pm, Henk-Jaap Wagenaar wrote: > > Thanks for having a look! The example now looks like (looking at int > > case only, same applies to UID): > > > > case int(): > > if value < 0: > >

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-17 Thread Henk-Jaap Wagenaar
> > That would work, but would be slower for the reference implementation > due to the repeated `isinstance(value, int)` checks. > If you wanted to avoid that you could use match/case inside the "case int()" instead, i.e.: case int(): match value: case _ if value < 8: // do

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-17 Thread Mark Shannon
On 17/08/2020 3:08 pm, Henk-Jaap Wagenaar wrote: Thanks for having a look! The example now looks like (looking at int case only, same applies to UID):         case int():             if value < 0:                 try:                     self._fp.write(struct.pack('>Bq', 0x13, value))  

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-17 Thread Marat Khalili
Hi all, I started reading it. You're saying the same things that everyone else has said, so I stopped reading. Do you have anything new to add to the discussion, or is this 2000 lines of rehash? I'm new to the subject, and I find the rehash of everything that has been said on the subject

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-17 Thread Henk-Jaap Wagenaar
Thanks for having a look! The example now looks like (looking at int case only, same applies to UID): case int(): if value < 0: try: self._fp.write(struct.pack('>Bq', 0x13, value)) except struct.error:

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-17 Thread Mark Shannon
On 17/08/2020 1:13 pm, Henk-Jaap Wagenaar wrote: On Mon, 17 Aug 2020 at 11:30, Mark Shannon > wrote: I would also bring you attention to my rigorous analysis of the possible application to PEP 622 the entirety of CPython. If I have made any mistakes

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-17 Thread Henk-Jaap Wagenaar
On Mon, 17 Aug 2020 at 11:30, Mark Shannon wrote: > > I would also bring you attention to my rigorous analysis of the possible > application to PEP 622 the entirety of CPython. > If I have made any mistakes there, I'd be happy to correct them. > > You say "I've elided a lot of complex logic int

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-17 Thread Mark Shannon
Hi Chris, On 14/08/2020 3:36 pm, Chris Angelico wrote: On Sat, Aug 15, 2020 at 12:32 AM Mark Shannon wrote: Hi all, I've written up a critique of PEP 622. Rather than dump a 2000 line email on you all, I've made a git repo. https://github.com/markshannon/pep622-critique I started

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-17 Thread Mark Shannon
On 15/08/2020 11:06 pm, Guido van Rossum wrote: On Fri, Aug 14, 2020 at 11:42 PM Steven D'Aprano > wrote: On Sat, Aug 15, 2020 at 12:36:25AM +1000, Chris Angelico wrote: > Do you have anything new to add to the discussion, or is this 2000 > lines of

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-17 Thread Stephen J. Turnbull
Steven D'Aprano writes: > Oh, I'm sorry, I based my comment on Chris' comment that Mark was > repeating everyone else's arguments. My bad :-( Mark can be tendentious. Some of his arguments in the main gist were also made by others, but mostly they do seem to be reiterations of his own pet

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-15 Thread Guido van Rossum
On Sat, Aug 15, 2020 at 5:00 PM Steven D'Aprano wrote: > I guess at some point I shall have to read the entire thread if I want > to have an opinion on this feature. > Or you could try reading the PEP itself. :-) It'll be quicker than reading all the commentary, and (unlike the first version)

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-15 Thread Steven D'Aprano
On Sat, Aug 15, 2020 at 03:06:46PM -0700, Guido van Rossum wrote: > But Mark's repo doesn't replace any of the threads -- it just repeats > Mark's own arguments, which are exclusively focused on the examples in the > PEP (it's as if Mark read nothing *but* the examples). Oh, I'm sorry, I based

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-15 Thread Guido van Rossum
On Fri, Aug 14, 2020 at 11:42 PM Steven D'Aprano wrote: > On Sat, Aug 15, 2020 at 12:36:25AM +1000, Chris Angelico wrote: > > > Do you have anything new to add to the discussion, or is this 2000 > > lines of rehash? > > Having a summary of objections/critiques in one place is far better than >

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-15 Thread Steven D'Aprano
On Sat, Aug 15, 2020 at 12:36:25AM +1000, Chris Angelico wrote: > Do you have anything new to add to the discussion, or is this 2000 > lines of rehash? Having a summary of objections/critiques in one place is far better than expecting people to wade through multiple huge threads. I've lost

[Python-Dev] Re: Critique of PEP 622 (Structural Pattern Matching)

2020-08-14 Thread Chris Angelico
On Sat, Aug 15, 2020 at 12:32 AM Mark Shannon wrote: > > Hi all, > > I've written up a critique of PEP 622. > Rather than dump a 2000 line email on you all, I've made a git repo. > > https://github.com/markshannon/pep622-critique > I started reading it. You're saying the same things that