-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Inconsistent behaviour of Optional in regards to Type[T] #9410
Comments
Quick answer: If you have more questions around this, please ask on Gitter. |
Yes but if this is the case I do not understand why using |
But why does this work for |
Please ask on Gitter. |
For anyone else stumbling across this: |
🐛 Bug Report
Optional[str]
is valid as an argument tocast
, however invalid as a value of a variable of typeType
.To Reproduce
Expected Behavior
The assignment to
c
passes type checking.Actual Behavior
Optional[str]
is apparently recognized as builtins.object and the assignment toc
get recognized as an invalid assignment. However the call tocast
(which itself does get typechecked) passes validation but also expects aType
.Your Environment
mypy 0.782
mypy.ini
(and other config files): nothingPython 3.8.2
Ubuntu 20.04.1 LTS
The text was updated successfully, but these errors were encountered: