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
Hi guys,
I couldn't find a similar issue, so apologies if there is a similar issue already open or closed.
Why doesn't this example show an error for wrong argument type in the last line:
import enum class TempEnum(enum.Enum): one = 1 two = 2 def test_func(arg: TempEnum) -> None: print(arg) test_func(TempEnum.one.value) # No error ?
Shouldn't this be an error as .value is an int? I'm using Python 3.5 and mypy 0.511.
Matic
The text was updated successfully, but these errors were encountered:
In the typing stub https://github.com/python/typeshed/blob/master/stdlib/3.4/enum.pyi#L25 Enum.value has type Any. MyPy can't narrow the type here. I believe there is thought on better support for Enum through plugins.
Enum.value
Any
Sorry, something went wrong.
@ethanhs Thanks for the details. It just feels counter-intuitive. Hope it gets upgraded.
No branches or pull requests
Hi guys,
I couldn't find a similar issue, so apologies if there is a similar issue already open or closed.
Why doesn't this example show an error for wrong argument type in the last line:
Shouldn't this be an error as .value is an int?
I'm using Python 3.5 and mypy 0.511.
Matic
The text was updated successfully, but these errors were encountered: