-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 indexing and iterating Enum type objects #741
Comments
@JukkaL Another related import enum
@enum.unique
class Color(enum.Enum):
red = 1
green = 2
blue = 3
for color in Color:
print(color) When run:
When
|
See also #2305. |
Is someone working on this? |
Not yet. |
Increasing priority since this seems to be among the most common issues mypy users encounter. |
I just have tried for color in Color:
print(color) still fails however. |
Yes, I just noticed that myself. |
Iterating is now fix by python/typeshed#1136. |
Thanks @gvanrossum! 😄 |
I'm not sure this is completely fixed: Adding an explicit annotation ( |
From the discussion on Gitter, it seems that |
Could you file a new issue? |
Forked off another issue at #3137 |
Assume this definition of
Color
:Now this should be valid, but mypy complains about it:
The error message indicates that mypy thinks that the programmer is trying to construct a generic type, which is not the case here:
The text was updated successfully, but these errors were encountered: