Repository navigation
Revert "Add __new__ to str and int stubs in both Pythons. (#1352)" - #1466
Merged
Merged
Conversation
matthiaskramm
suggested changes
Jul 5, 2017
|
|
||
| class IntEnum(int, Enum): # type: ignore | ||
| def __new__(cls: Type[_T], value: Any) -> _T: ... | ||
| class IntEnum(int, Enum): ... |
Contributor
There was a problem hiding this comment.
If you're removing the explicit __new__, would it make sense to make the base class order "Enum, int" so that __new__ is inherited from Enum, not int?
Member
Author
There was a problem hiding this comment.
I also removed __new__ from int, so I don't think that makes a difference. Int comes first at runtime (https://github.com/python/cpython/blob/master/Lib/enum.py#L639), so putting Enum first here will probably break something.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This reverts commit fed4e03.
See #1464.
This doesn't completely fix #1464; I still get "bin/enumindex.py:9: error: Value of type Type[I] is not indexable" for an enum inheriting from int and Enum. But some of the errors are gone.