Would it be possible to drop the requirement that multiple exception types are parenthesized? Is it only ambiguous with the old Python2 syntax?On Sat, 8 May 2021, 20:15 Guido van Rossum, <guido@python.org> wrote:I propose “exception tuple”, since syntactically and semantically it must be a tuple. (Same as for isinstance() and issubclass().)--On Sat, May 8, 2021 at 05:52 Thomas Grainger <tagrain@gmail.com> wrote:That's this bit:
```
except (A, B):
^^^^^^
```
bpo-43149 currently calls it an "exception group", but that conflicts with PEP 654 -- Exception Groups and except*
```
>>> try:
... pass
... except A, B:
... pass
Traceback (most recent call last):
SyntaxError: exception group must be parenthesized
```
some alternatives:
exception classinfo must be parenthesized (classinfo so named from the parameter to issubclass)
exception sequence must be parenthesized
see also:
- https://github.com/python/cpython/pull/24467#discussion_r628756347
- https://www.python.org/dev/peps/pep-0654/
_______________________________________________
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/HSN6ESRB4BD6IUIPKLMNP4TPBQPWHBFK/
Code of Conduct: http://python.org/psf/codeofconduct/
--Guido (mobile)