-
Notifications
You must be signed in to change notification settings - Fork 282
Closed
Description
Currently unions are simplified at runtime, for example:
class B: ...
class C(B): ...
assert Union[C, B] is BAlso they are flattened, for example Union[A, Union[B, C]] evaluates to Union[A, B, C]. There are however some downsides:
- Simplification of unions is a concept related to static types, applying it at runtime might blur the distinction between static types and runtime classes.
- Implementation of this feature had bugs, all of them related to the fact that
issublcassis only applicable to proper classes, and it is not always easy to detect those beforehand. - This has some (although minor) runtime costs.
On the positive side:
- This still teaches people how unions work with subclasses
- It may be too late to change this.
Metadata
Metadata
Assignees
Labels
No labels