We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Now that runtime generics are allowed (thanks to #2302), we should prevent people from making calls like:
isinstance(["foo"], List[int])
because it won't behave as expected. I.e. in this case, it will return True. (First instance of user confusion appeared in #2369.)
The text was updated successfully, but these errors were encountered:
Latest version of typing.py raises TypeError for things like this. Only unsubscripted generics etc. are allowed with instance/class checks.
typing.py
TypeError
Sorry, something went wrong.
But mypy still doesn't give an error!
Oops, sorry. Classified as bug for milestone 0.5. (Since it's a runtime error I don't think it's a very big deal if mypy doesn't catch it.)
This is fixed now, mypy says
error: Parameterized generics cannot be used with class or instance checks
No branches or pull requests
Now that runtime generics are allowed (thanks to #2302), we should prevent people from making calls like:
because it won't behave as expected. I.e. in this case, it will return True. (First instance of user confusion appeared in #2369.)
The text was updated successfully, but these errors were encountered: