Message414807
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. |
|
Date |
User |
Action |
Args |
2022-03-09 17:49:02 | Henry Schreiner | set | recipients:
+ Henry Schreiner |
2022-03-09 17:49:02 | Henry Schreiner | set | messageid: <1646848142.9.0.223249735581.issue46967@roundup.psfhosted.org> |
2022-03-09 17:49:02 | Henry Schreiner | link | issue46967 messages |
2022-03-09 17:49:02 | Henry Schreiner | create | |
|