Title: Support special `object.__new__` and `object.__init__` in `super`. · Issue #794 · python/mypy · GitHub
Open Graph Title: Support special `object.__new__` and `object.__init__` in `super`. · Issue #794 · python/mypy
X Title: Support special `object.__new__` and `object.__init__` in `super`. · Issue #794 · python/mypy
Description: Currently, __new__ is not special at all. While full support is complicated, it is particularly irritating that object.__new__ cannot be added to stubs at all, since subclasses need to override it with different signatures and that is an...
Open Graph Description: Currently, __new__ is not special at all. While full support is complicated, it is particularly irritating that object.__new__ cannot be added to stubs at all, since subclasses need to override it ...
X Description: Currently, __new__ is not special at all. While full support is complicated, it is particularly irritating that object.__new__ cannot be added to stubs at all, since subclasses need to override it ...
Opengraph URL: https://github.com/python/mypy/issues/794
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support special `object.__new__` and `object.__init__` in `super`.","articleBody":"Currently, `__new__` is not special at all. While full support is complicated, it is particularly irritating that `object.__new__` cannot be added to stubs at all, since subclasses need to override it with different signatures and that is an error.\n\n`object.__new__` and `object.__init__` are special in another way. For the `object` class itself, their signatures are `(Subclass[T]) -> T` and `(T) -> None`. However, when called from subclass constructors via `super()`, the signatures are `(Subclass[T], *args, **kwargs) -> T` and `(T, *args, **kwargs) -> None`.\n\nIn the above, `T` is a `TypeVar` that is bounded by the current class, and `Subclass[T]` is basically `Intersection[type, Callable[..., T]]` (i.e. supports duck typing once the `Protocol` stuff works).\n\n(In my notes I am using use the term `Class[T]` to refer to `Intersection[type, Callable[[signature of __init__], T]]`)\n\nAs an icky workaround, I tried using `cast(Any, super())`, but that says that `super` is not defined, before settling on `# type: ignore`\n","author":{"url":"https://github.com/o11c","@type":"Person","name":"o11c"},"datePublished":"2015-08-18T02:56:08Z","url":"https://github.com/python/mypy/issues/794"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:e68da690-da36-f6a4-7ce2-7fa57bafafd2 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BEFE:C5FC2:177B184:1EF75FD:6B002204 |
| html-safe-nonce | dbae6e88c7fe5cd4abf5930148b8acb9db911bc8ddfa87707923e91939ebc395 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCRUZFOkM1RkMyOjE3N0IxODQ6MUVGNzVGRDo2QjAwMjIwNCIsInZpc2l0b3JfaWQiOiI1MzQwMzk3MDcxMDQyMDkzNTcyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | f67b2942db3e6c936ffda607a34a2e3edc18283f88f854c5bfd5205731a7674f |
| hovercard-subject-tag | issue:101558170 |
| 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/mypy/794/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6854deec07e10340a5c669e971ac4b0cd0a34badc5ae6724e37d68a0886992e8/python/mypy/issues/794 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6854deec07e10340a5c669e971ac4b0cd0a34badc5ae6724e37d68a0886992e8/python/mypy/issues/794 |
| og:image:alt | Currently, __new__ is not special at all. While full support is complicated, it is particularly irritating that object.__new__ cannot be added to stubs at all, since subclasses need to override it ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | o11c |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width