You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For runtime typechecking deep_type is used to determine the PEP 484 type of a given object. Then is_subtype is used to detect if the type is acceptable. E.g. [2] is considered List[int] by deep_type although it could also be List[float] or List[Union[int, whatever]].
Solution idea:
Widen the use of Empty which is currently used to handle [] and {}, etc.
It would be renamed to Sampled or so and serve as a marker type for is_subtype to check its contained type, e.g. Sampled[List[int]] in covariant manner even if it is actually invariant.
The text was updated successfully, but these errors were encountered:
Yes that's right. Or at least invisible unless some debug flag is set. I would cure this in type_str. However this won't fix before Python 3.7 compatibility is achieved because it requires some broader restructuring. I have rather limited capacity to tackle these bigger changes.
For runtime typechecking
deep_type
is used to determine the PEP 484 type of a given object. Thenis_subtype
is used to detect if the type is acceptable. E.g.[2]
is consideredList[int]
bydeep_type
although it could also beList[float]
orList[Union[int, whatever]]
.Solution idea:
Widen the use of
Empty
which is currently used to handle[]
and{}
, etc.It would be renamed to
Sampled
or so and serve as a marker type foris_subtype
to check its contained type, e.g.Sampled[List[int]]
in covariant manner even if it is actually invariant.The text was updated successfully, but these errors were encountered: