Title: Inheritance issues with generic collections · Issue #202 · python/typing · GitHub
Open Graph Title: Inheritance issues with generic collections · Issue #202 · python/typing
X Title: Inheritance issues with generic collections · Issue #202 · python/typing
Description: I have a problem with how __extra__ is currently inherited: >>> class CustomMapping(typing.Mapping): ... ... >>> issubclass(dict, CustomMapping) True >>> class CustomDict(typing.Dict): ... ... >>> issubclass(dict, CustomDict) True This c...
Open Graph Description: I have a problem with how __extra__ is currently inherited: >>> class CustomMapping(typing.Mapping): ... ... >>> issubclass(dict, CustomMapping) True >>> class CustomDict(typing.Dict): ... ... >>> ...
X Description: I have a problem with how __extra__ is currently inherited: >>> class CustomMapping(typing.Mapping): ... ... >>> issubclass(dict, CustomMapping) True >>> class CustomDict...
Opengraph URL: https://github.com/python/typing/issues/202
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inheritance issues with generic collections","articleBody":"I have a problem with how `__extra__` is currently inherited:\n\n``` python\n>>> class CustomMapping(typing.Mapping): ...\n... \n>>> issubclass(dict, CustomMapping)\nTrue\n```\n\n``` python\n>>> class CustomDict(typing.Dict): ...\n... \n>>> issubclass(dict, CustomDict)\nTrue\n```\n\nThis can't be right.\n\nMy initial impression is that `__extra__` should only be propagated on parameterization, not when subclassing, and that the concrete types `List`, `Dict`, etc. should have their own extras (`list`, `dict`, and so on). Thoughts? A tentative patch is [here](https://github.com/python/typing/compare/master...bintoro:extra-inheritance).\n\nAnother thing: The module distributed on PyPI still has the issue where a generic doesn't include itself in the subtype's MRO during parameterization. This was fixed for Python 3.5.1 in aab2c59. It would be great if we could get a more recent revision on PyPI as well.\n\n3.5.1:\n\n``` python\n>>> issubclass(Iterable[int], Iterable)\nTrue\n```\n\n3.5.0:\n\n``` python\n>>> issubclass(Iterable[int], Iterable)\nFalse\n```\n\nAnd finally, a question: The `collections` ABC replacements do not provide the abstract (or any other) methods of the originals. In particular, `Iterable` is technically not abstract at all. Is this intentional or just a temporary state of affairs?\n","author":{"url":"https://github.com/bintoro","@type":"Person","name":"bintoro"},"datePublished":"2016-04-16T00:10:25Z","url":"https://github.com/python/typing/issues/202"}
| 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:fe8ebc4f-5c0b-cd07-149d-052152f2b38f |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C164:18126A:66730:8B0B8:6B0018A2 |
| html-safe-nonce | dee9015f1bbfeb456fd44a79a59a995943a02d0b5362986e2b369255baafecd9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMTY0OjE4MTI2QTo2NjczMDo4QjBCODo2QjAwMThBMiIsInZpc2l0b3JfaWQiOiIyNjQyNjQwMTM4NjA5MzY3MjAyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6beeb409f00ea0ae1ff60b0079db2dea8b24ceb6e0b0623ecb9fd22e737768ac |
| hovercard-subject-tag | issue:148797189 |
| 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/typing/202/issue_layout |
| twitter:image | https://opengraph.githubassets.com/42e4ee46aaa9ed3ffcfa3ddbe3da9d0e3d09aadfe1788324151b00f176a00735/python/typing/issues/202 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/42e4ee46aaa9ed3ffcfa3ddbe3da9d0e3d09aadfe1788324151b00f176a00735/python/typing/issues/202 |
| og:image:alt | I have a problem with how __extra__ is currently inherited: >>> class CustomMapping(typing.Mapping): ... ... >>> issubclass(dict, CustomMapping) True >>> class CustomDict(typing.Dict): ... ... >>> ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | bintoro |
| hostname | github.com |
| expected-hostname | github.com |
| None | a2dd2291b1b13cc9c06f27ec92fa3dbaf34116fc24c9347b8539db61884c59f4 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typing git https://github.com/python/typing.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 24604008 |
| octolytics-dimension-repository_nwo | python/typing |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24604008 |
| octolytics-dimension-repository_network_root_nwo | python/typing |
| 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 | 70121d4e855ee0bb7b75cf15d061d91f8863c0f8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width