[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Guido van Rossum
On Sun, Oct 3, 2021 at 9:20 PM Jonathan Goble wrote: > Therefore my vote is for requiring `except* E` and keeping `except *E` as > a SyntaxError. > You can't do that with our current lexer+parser. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)*

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Jonathan Goble
On Sun, Oct 3, 2021 at 11:40 PM Steven D'Aprano wrote: > On Sun, Oct 03, 2021 at 11:34:55AM -0700, Guido van Rossum wrote: > > > I also think that the bar should be pretty high before we reopen the > > *syntax* -- the PEP was approved without anyone (neither the SC, nor > > Nathaniel, nor anyone

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Steven D'Aprano
On Sun, Oct 03, 2021 at 11:34:55AM -0700, Guido van Rossum wrote: > I also think that the bar should be pretty high before we reopen the > *syntax* -- the PEP was approved without anyone (neither the SC, nor > Nathaniel, nor anyone else) providing any feedback on the use of 'except > *'. So I

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Barry Warsaw
On Oct 3, 2021, at 10:42, Łukasz Langa wrote: > > My idea is this: > > try: >... > except group E as e: >... > except group E1, T2 as e: >... > > Should be doable given the magical match-case contextual keywords precedent. > This looks nice and is explicit, since you will always

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Gregory P. Smith
On Sun, Oct 3, 2021 at 10:47 AM Łukasz Langa wrote: > > I know it's a bit late for bikeshedding this thing so if we want to be > conservative and stick to the current syntactical options already defined > in PEP 654, I'm voting Option 2 (given the awkwardness of the *(E1, E2) > example). > +1

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Łukasz Langa
> On 3 Oct 2021, at 20:11, MRAB wrote: > > On 2021-10-03 18:50, Brandt Bucher wrote: >> Łukasz Langa wrote: >>> My idea is this: >>> try: >>>... >>> except group E as e: >>>... >>> except group E1, T2 as e: >>>... >>> Should be doable given the magical match-case contextual keywords

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Guido van Rossum
On Sun, Oct 3, 2021 at 11:28 AM Irit Katriel via Python-Dev < python-dev@python.org> wrote: > We can drop except. Say: > > try: > .. > handle T1: >… > handle T2: >… > > Or ‘catch’, or something else. > We're going around in circles. We considered 'catch' early on, but decided against

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Irit Katriel via Python-Dev
We can drop except. Say: try: .. handle T1: … handle T2: … Or ‘catch’, or something else. > On 3 Oct 2021, at 19:12, MRAB wrote: > > On 2021-10-03 18:50, Brandt Bucher wrote: >> Łukasz Langa wrote: >>> My idea is this: >>> try: >>>... >>> except group E as e: >>>... >>>

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread MRAB
On 2021-10-03 18:50, Brandt Bucher wrote: Łukasz Langa wrote: My idea is this: try: ... except group E as e: ... except group E1, T2 as e: ... Should be doable given the magical match-case contextual keywords precedent. This looks nice and is explicit, since you will always get an

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Brandt Bucher
Łukasz Langa wrote: > My idea is this: > try: > ... > except group E as e: > ... > except group E1, T2 as e: > ... > Should be doable given the magical match-case contextual keywords precedent. > This looks nice and is explicit, since you will always get an ExceptionGroup > instance

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Brandt Bucher
Irit Katriel wrote: > It is also not too late to opt for a completely different syntax if a better > one is suggested. Honestly, I’ve never been a fan of the PEP’s proposed star syntax. If we’re okay adding a soft keyword, though, something like “except each” could help communicate the meaning

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Łukasz Langa
> On 3 Oct 2021, at 18:37, Steven D'Aprano wrote: > > On Sun, Oct 03, 2021 at 04:47:57PM +0100, Irit Katriel via Python-Dev wrote: >> We wonder if people have a view on which of the following is clearer/better: >> >> 1. except *E as e: // except *(E1, E2) as e: > > That looks like you're

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Steven D'Aprano
On Sun, Oct 03, 2021 at 04:47:57PM +0100, Irit Katriel via Python-Dev wrote: > We wonder if people have a view on which of the following is clearer/better: > > 1. except *E as e: // except *(E1, E2) as e: That looks like you're unpacking the tuple (E1, E2), and that's just misleading and

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Jim J. Jewett
except* looks like the exception statement has a footnote, which isn't wrong. *(E1, E2) looks like they are being unpacked, which is wrong. -jJ ___ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Paul Moore
On Sun, 3 Oct 2021 at 16:55, Irit Katriel via Python-Dev wrote: > > We wonder if people have a view on which of the following is clearer/better: > > 1. except *E as e: // except *(E1, E2) as e: > 2. except* E as e: // except* (E1, E2) as e: > > (The difference is in the whitespace around the

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Guido van Rossum
We’ll, typically you don’t explicitly mention ExceptionGroup — it’s implied by the ‘except*’ syntax. Introducing match semantics probably wouldn’t open up new functionality, you can already write ‘except (E1, E2):’. On Sun, Oct 3, 2021 at 09:00 Thomas Grainger wrote: > What about `except case

[Python-Dev] Re: PEP 654 except* formatting

2021-10-03 Thread Thomas Grainger
What about `except case ExceptionGroup[E1 | E2]:`? and use match semantics? On Sun, 3 Oct 2021, 16:50 Irit Katriel via Python-Dev, < python-dev@python.org> wrote: > > We wonder if people have a view on which of the following is > clearer/better: > > 1. except *E as e: // except *(E1, E2) as e:

[Python-Dev] PEP 654 except* formatting

2021-10-03 Thread Irit Katriel via Python-Dev
We wonder if people have a view on which of the following is clearer/better: 1. except *E as e: // except *(E1, E2) as e: 2. except* E as e: // except* (E1, E2) as e: (The difference is in the whitespace around the *). At the moment * is a separate token so both are allowed, but we could