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")
/arry
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. -BarryOn Oct 5, 2021, at 11:15, sascha.schlemmer--- via Python-Dev <python-dev@python.org> wrote: 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: ... _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/PFYQC7XMYFAGOPU5C2YVMND2BQSIJPRC/ Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-leave@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/SZNDJPKT7WNWJHG4UDJ6D3BU6IN5ZXZO/ Code of Conduct: http://python.org/psf/codeofconduct/