GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||
GeezerVison is showing github.com — gh-128080: remove unnecessary `__init__` method from Enum by tungol · Pull Request #128081 · python/cpython Conversation
|
| def __dir__(cls): | |
| # TODO: check for custom __init__, __new__, __format__, __repr__, __str__, __init_subclass__ | |
| # on object-based enums | |
| if cls._member_type_ is object: | |
| interesting = set(cls._member_names_) | |
| if cls._new_member_ is not object.__new__: | |
| interesting.add('__new__') | |
| if cls.__init_subclass__ is not object.__init_subclass__: | |
| interesting.add('__init_subclass__') | |
| for method in ('__init__', '__format__', '__repr__', '__str__'): | |
| if getattr(cls, method) not in (getattr(Enum, method), getattr(Flag, method)): | |
| interesting.add(method) |
That special handling of __init__ was removed by #30677 prior to 3.11 being released, which leaves no plausible function to Enum.__init__ that I can see. It muddies introspection of the type, so I think we should remove it if that's really the case.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I've fixed the failing macOS CI for you :) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…onGH-128081) remove unnecessary __init__ method from Enum Co-authored-by: Peter Bierma <[email protected]>
…onGH-128081) remove unnecessary __init__ method from Enum Co-authored-by: Peter Bierma <[email protected]>
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.