Title: Implement `_from_iterable` on `builtins.set` and`builtins.frozenset` · Issue #144557 · python/cpython · GitHub
Open Graph Title: Implement `_from_iterable` on `builtins.set` and`builtins.frozenset` · Issue #144557 · python/cpython
X Title: Implement `_from_iterable` on `builtins.set` and`builtins.frozenset` · Issue #144557 · python/cpython
Description: Proposal: collections.abc.{Set, MutableSet} implement a _from_iterable method, documented here: https://docs.python.org/3/library/collections.abc.html However, builtins.frozenset and builtins.set, which are marked as inherting from Set a...
Open Graph Description: Proposal: collections.abc.{Set, MutableSet} implement a _from_iterable method, documented here: https://docs.python.org/3/library/collections.abc.html However, builtins.frozenset and builtins.set, ...
X Description: Proposal: collections.abc.{Set, MutableSet} implement a _from_iterable method, documented here: https://docs.python.org/3/library/collections.abc.html However, builtins.frozenset and builtins.set, ...
Opengraph URL: https://github.com/python/cpython/issues/144557
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Implement `_from_iterable` on `builtins.set` and`builtins.frozenset`","articleBody":"### Proposal:\n\n`collections.abc.{Set, MutableSet}` implement a `_from_iterable` method, documented here: https://docs.python.org/3/library/collections.abc.html\n\nHowever, `builtins.frozenset` and `builtins.set`, which are marked as inherting from `Set` and `MutableSet`, do not implement this constructor, therefore `typeshed` is kind of blocked from adding these methods in the stubs, as it would lead to unsafe code:\n\n```python\ndef f(x: MutableSet) -> MutableSet:\n # passes type checking if _from_iterable is added to MutableSet\n return type(x)._from_iterable(x) \n\nf( {1,2,3} ) # Error at runtime\n```\n\n## Alternatives\n\n`typeshed` could just decide to never add the `_from_iterable` method, people can still override it regardless to get the desired runtime behavior on types that use the `Set` and `MutableSet` mixins that rely on this method.\n\n### Has this already been discussed elsewhere?\n\nhttps://github.com/python/typeshed/issues/15298\n\n### Links to previous discussion of this feature:\n\n_No response_","author":{"url":"https://github.com/randolf-scholz","@type":"Person","name":"randolf-scholz"},"datePublished":"2026-02-07T09:11:49Z","url":"https://github.com/python/cpython/issues/144557"}
| 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:97df007c-818c-d85f-cbf1-d0f626a5d498 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9054:30E5B0:373AFAC:495AAA6:6B0049FB |
| html-safe-nonce | 54b078d733f1a29652378b61103430c18175bccf5dd0dfe4d6d6fced02ea9f9a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MDU0OjMwRTVCMDozNzNBRkFDOjQ5NUFBQTY6NkIwMDQ5RkIiLCJ2aXNpdG9yX2lkIjoiMjUzNDM4MDExMDYxNDY0NTI0MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4c017c5d76bdfd81a863810a323d5020b151414e8fc1f079b62a04f4d51b1d75 |
| hovercard-subject-tag | issue:3909850983 |
| 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/144557/issue_layout |
| twitter:image | https://opengraph.githubassets.com/79474a95788aa561ec9c085b64c73f31c1782c49f7a57bbfdb840cab3fae4df9/python/cpython/issues/144557 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/79474a95788aa561ec9c085b64c73f31c1782c49f7a57bbfdb840cab3fae4df9/python/cpython/issues/144557 |
| og:image:alt | Proposal: collections.abc.{Set, MutableSet} implement a _from_iterable method, documented here: https://docs.python.org/3/library/collections.abc.html However, builtins.frozenset and builtins.set, ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | randolf-scholz |
| hostname | github.com |
| expected-hostname | github.com |
| None | f9517bf360d46638a1e5e7daee7158842fe5ef43c9000afa0e127564a7c2f39b |
| 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 | b27c5dde30676028abd5c5fc53ce5c9b625f8281 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width