How about "except_group", or "exceptgroup"? That's definitely not ambiguous, and can certainly work as a soft keyword.
On 06/10/2021 11:06, Larry Hastings wrote:
It seems like, for this to work, "group" would have to become a keyword. This would play havoc with a lot of existing code. I can't tell you how many times I've used the identifier "group" in my code, particularly when dealing with regular expressions.
Even making it a soft keyword, a la "await" in 3.5, would lead to ambiguity:
group = KeyboardInterrupt try: while True: print("thou can only defeat me with Ctrl-C") except group as error: print("lo, thou hast defeated me")
On 10/6/21 2:12 AM, Barry Warsaw wrote:
What do the PEP authors think about `except group`? Bikeshedding aside, that’s still the best alternative I’ve seen. It’s unambiguous, self-descriptive, and can’t be confused with unpacking syntax.
I agree that *(E1, E2) looks like unpacking, how about
except *E1 as error: ... except (*E1, *E2) as error: ...
even better would be if we could drop the braces: except *E1, *E2 as error: ...