Title: Being unable to specify the API for instantiating an object is a deleterious restriction for Protocols · Issue #110788 · python/cpython · GitHub
Open Graph Title: Being unable to specify the API for instantiating an object is a deleterious restriction for Protocols · Issue #110788 · python/cpython
X Title: Being unable to specify the API for instantiating an object is a deleterious restriction for Protocols · Issue #110788 · python/cpython
Description: It makes no sense to be unable to specify the interface for instantiating a class object. The only way around this at the moment is to specify a class method that serves the literal same purpose as the __init__ method, then relying upon ...
Open Graph Description: It makes no sense to be unable to specify the interface for instantiating a class object. The only way around this at the moment is to specify a class method that serves the literal same purpose as...
X Description: It makes no sense to be unable to specify the interface for instantiating a class object. The only way around this at the moment is to specify a class method that serves the literal same purpose as...
Opengraph URL: https://github.com/python/cpython/issues/110788
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Being unable to specify the API for instantiating an object is a deleterious restriction for Protocols","articleBody":"It makes no sense to be unable to specify the interface for instantiating a class object. The only way around this at the moment is to specify a class method that serves the literal same purpose as the `__init__` method, then relying upon it instead of the normal mechanism for object instantiation.\r\n\r\nThis is one of the poorest design decisions in CPython in my opinion. It breaks introspection tools that seek to document the required `__init__` API, and it breaks even the concept of checking if the required `__init__` API is followed. As I said, the only way around this is to create a new class method that merely replicates what the built-in `__init__` method is supposed to do.\r\n\r\nhttps://github.com/python/cpython/blob/b4e48a444ea02921ce4b701fe165e6cfd4cf5845/Lib/typing.py#L1430\r\n\r\nIf there is some justification for this frustrating antipattern, please let me know. I do not see anything about this in PEP-544, though I only skimmed it looking for an answer and did not study it thoroughly.","author":{"url":"https://github.com/k98kurz","@type":"Person","name":"k98kurz"},"datePublished":"2023-10-12T23:36:57.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":7},"url":"https://github.com/110788/cpython/issues/110788"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1ff8b2e7-d67f-cced-cefb-2c0b38ee6b7c |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B8A0:1EAB80:202CC6:2AF155:6969BF5A |
| html-safe-nonce | 8717c9a7b794e4a86cb8659e317083ddfa14a03489933cfcb0f67304d164b7be |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOEEwOjFFQUI4MDoyMDJDQzY6MkFGMTU1OjY5NjlCRjVBIiwidmlzaXRvcl9pZCI6IjQzMjkzMDcxNzYyMDc3NjEyNDIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 482ec51690627911a9e67dfce8c375ca6e6dc3e300045b065231aace0c77bb7b |
| hovercard-subject-tag | issue:1940963143 |
| github-keyboard-shortcuts | repository,issues,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/_view_fragments/issues/show/python/cpython/110788/issue_layout |
| twitter:image | https://opengraph.githubassets.com/80d2b863e26c4c14b2fdf5424b91f475651914399d2d0dde609964532f1ac3d2/python/cpython/issues/110788 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/80d2b863e26c4c14b2fdf5424b91f475651914399d2d0dde609964532f1ac3d2/python/cpython/issues/110788 |
| og:image:alt | It makes no sense to be unable to specify the interface for instantiating a class object. The only way around this at the moment is to specify a class method that serves the literal same purpose as... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | k98kurz |
| hostname | github.com |
| expected-hostname | github.com |
| None | acedec8b5f975d9e3d494ddd8f949b0b8a0de59d393901e26f73df9dcba80056 |
| turbo-cache-control | no-preview |
| 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 | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 83c08c21cdda978090dc44364b71aa5bc6dcea79 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width