On 6 Oct 2021, at 12:06, Larry Hastings <larry@hastings.org> wrote:

It seems like, for this to work, "group" would have to become a keyword.

No, just like `match` and `case` didn't have to.

This would play havoc with a lot of existing code.

Extraordinary claims require extraordinary evidence, Larry. I maintain this will be entirely backwards compatible.

Even making it a soft keyword, a la "await" in 3.5, would lead to ambiguity: 

group = KeyboardInterrupt

    while True:
        print("thou can only defeat me with Ctrl-C")
except group as error:
    print("lo, thou hast defeated me")

Two things:

1. This is a convoluted example, I bet $100 you won't find such an `except group` statement in any code predating my e-mail 🤠 Sure, sometimes (very rarely) it's useful to gather exceptions in a variable. But I'm pretty sure `group` won't be the name chosen for it.

2. While non-obvious, the example is not ambiguous. There can only be one parsing rule fitting this:

'except' expression 'as' NAME ':'

Note how this is different from:

'except' 'group' expression 'as' NAME ':'

There could be confusion if except-star, whatever its name is going to be, supported an empty "catch all" variant like `except:`. Thankfully, this is explicitly listed as a no-go in PEP 654. So `except group:` remains unambiguous. We can even make its error message smarter than the default NameError, since -- as I claim -- it's terribly unlikely somebody would mean to name their dynamic exception collection "group".

- Ł