gh-128080: remove unnecessary __init__
method from Enum
#128081
Merged
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.
Enum gained an
__init__
method in 3.11 which just passes:That was added in #30582. One person questioned it at the time, but there was no response. The best I can figure is that it was related to special handling of
__init__
inEnumType.__dir__
, which you can see here:cpython/Lib/enum.py
Lines 768 to 779 in 3852269
That special handling of
__init__
was removed by #30677 prior to 3.11 being released, which leaves no plausible function toEnum.__init__
that I can see. It muddies introspection of the type, so I think we should remove it if that's really the case.enum.Enum.__init__
serves no purpose #128080