This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Henry Schreiner
Recipients Henry Schreiner
Date 2022-03-09.17:49:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1646848142.9.0.223249735581.issue46967@roundup.psfhosted.org>
In-reply-to
Content
In 3.10 via PEP 604, there was an attempt to use the new union of types where runtime types were previously expected to be a tuple. `isinstance(x, (A, B))` can be written `isinstance(x, A | B)`. Unfortunately, there still is a case were a tuple of types is required: `except (A, B) as err:` cannot be written `except A | B as err:`. I think this should be allowed; it is consistent with isinstance and pattern matching's use of |, and nicely avoids confusion with `except A, B:` which is disallowed for Python 2 reasons; `except A | B`: would be valid.
History
Date User Action Args
2022-03-09 17:49:02Henry Schreinersetrecipients: + Henry Schreiner
2022-03-09 17:49:02Henry Schreinersetmessageid: <1646848142.9.0.223249735581.issue46967@roundup.psfhosted.org>
2022-03-09 17:49:02Henry Schreinerlinkissue46967 messages
2022-03-09 17:49:02Henry Schreinercreate