-
-
Notifications
You must be signed in to change notification settings - Fork 32.9k
Closed as not planned
Closed as not planned
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-typingtype-featureA feature request or enhancementA feature request or enhancement
Description
Feature or enhancement
Proposal:
This was pointed out by Nikita Sobolev in #106246 (comment), it seemed worthwhile to have as a separate issue.
from typing import TypeAlias
# old style
Number: TypeAlias = int | float
assert isinstance(0, Number) # ✅
# new style
type Number = int | float
assert isinstance(0, Number) # ❌ TypeError: isinstance() arg 2 must be a type, a tuple of types, or a unionThis prevents changing old code to the new PEP 695 syntax if type aliases define unions and are used in isinstance checks.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
No response
Linked PRs
MrShirokow
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-typingtype-featureA feature request or enhancementA feature request or enhancement

