[issue46967] Type union for except

2022-03-13 Thread Irit Katriel
Irit Katriel added the comment: > I don't think that `except A|B` looks better than `except (A, B)` I agree. -- resolution: -> rejected stage: -> resolved status: open -> closed ___ Python tracker

[issue46967] Type union for except

2022-03-09 Thread Guido van Rossum
Guido van Rossum added the comment: I don't think that `except A|B` looks better than `except (A, B)`, so I am against this proposal. Exception matching is its own special thing (e.g. it doesn't honor virtual subclasses) and we shouldn't hyper-generalize. --

[issue46967] Type union for except

2022-03-09 Thread Steven D'Aprano
Change by Steven D'Aprano : -- nosy: +steven.daprano ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue46967] Type union for except

2022-03-09 Thread Jelle Zijlstra
Jelle Zijlstra added the comment: This would be nice but I'm not sure it's worth the hassle in terms of documentation, tooling support, etc. There is an existing issue (that I can't find right now) that makes the `except` machinery use `__instancecheck__`, instead of looking only at real

[issue46967] Type union for except

2022-03-09 Thread Alex Waygood
Change by Alex Waygood : -- nosy: +AlexWaygood, Jelle Zijlstra, gvanrossum, iritkatriel ___ Python tracker ___ ___ Python-bugs-list

[issue46967] Type union for except

2022-03-09 Thread Henry Schreiner
New submission from Henry Schreiner : 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