Title: gh-128080: remove unnecessary `__init__` method from Enum by tungol · Pull Request #128081 · python/cpython · GitHub
Open Graph Title: gh-128080: remove unnecessary `__init__` method from Enum by tungol · Pull Request #128081 · python/cpython
X Title: gh-128080: remove unnecessary `__init__` method from Enum by tungol · Pull Request #128081 · python/cpython
Description: Enum gained an __init__ method in 3.11 which just passes: def __init__(self, *args, **kwds): pass 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__ in EnumType.__dir__, which you can see here: cpython/Lib/enum.py Lines 768 to 779 in 3852269 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. Issue: gh-128080
Open Graph Description: Enum gained an __init__ method in 3.11 which just passes: def __init__(self, *args, **kwds): pass That was added in #30582. One person questioned it at the time, but there was no respon...
X Description: Enum gained an __init__ method in 3.11 which just passes: def __init__(self, *args, **kwds): pass That was added in #30582. One person questioned it at the time, but there was no respon...
Opengraph URL: https://github.com/python/cpython/pull/128081
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:1cdd3013-6f58-cb61-48a5-634427379f78 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A1CA:2FB293:6F0D67:96F6D2:6969DEB0 |
| html-safe-nonce | fed1cfbaef712094c0c37a9c4054e09a1268578d409c46e35109e39e029dc327 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMUNBOjJGQjI5Mzo2RjBENjc6OTZGNkQyOjY5NjlERUIwIiwidmlzaXRvcl9pZCI6IjI4MzYzODE2OTM3ODM5NTcxNjgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0dfd6639950d01fafc40be5ece303f82fb2e7ee022588f32cf34491b04d366b9 |
| hovercard-subject-tag | pull_request:2243103341 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/128081/files |
| twitter:image | https://avatars.githubusercontent.com/u/562175?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/562175?s=400&v=4 |
| og:image:alt | Enum gained an __init__ method in 3.11 which just passes: def __init__(self, *args, **kwds): pass That was added in #30582. One person questioned it at the time, but there was no respon... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | canary-1 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width