-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for ReifiedGeneric
s
#5
Comments
mypy doesnt need to be changed to accommodate for the |
actually it does, since isinstance(Reified[int, str](), Reified[int, str]) # Parameterized generics cannot be used with class or instance checks [misc] |
i was originally going to makeour own _T_type = TypeVar("_T_type", bound=type)
@overload
def is_instance(__obj: object, __class_or_tuple: _T_type) -> TypeGuard[_T_type]:
...
@overload
def is_instance(
__obj: object,
__class_or_tuple: UnionType | tuple[type | UnionType | tuple[object, ...], ...],
) -> bool:
...
def is_instance(
__obj: object,
__class_or_tuple: type
| UnionType
| tuple[type | UnionType | tuple[object, ...], ...],
) -> bool:
return isinstance(__obj, __class_or_tuple) but that didn't work due to python#11428 |
I think modifying mypy checks are much better idea than making a typeguard |
perhaps, but i prefer using existing functionality instead of intrinsic hidden behavior where possible. the fact that |
imo |
ReifiedGeneric
sReifiedGeneric
s (isinstance
and issubclass
)
ReifiedGeneric
s (isinstance
and issubclass
)ReifiedGeneric
s
Reified Generics in basedtyping need special casing in basedmypy.
isinstance
andissubclass
:Ban
TypeVar
s:The text was updated successfully, but these errors were encountered: