René's URL Explorer Experiment


Title: The type of __default= in dict.pop and dict.get doesn't look right · Issue #10293 · python/typeshed · GitHub

Open Graph Title: The type of __default= in dict.pop and dict.get doesn't look right · Issue #10293 · python/typeshed

X Title: The type of __default= in dict.pop and dict.get doesn't look right · Issue #10293 · python/typeshed

Description: dict.pop is currently defined as typeshed/stdlib/builtins.pyi Lines 1086 to 1089 in 1851423 @overload def pop(self, __key: _KT) -> _VT: ... @overload def pop(self, __key: _KT, __default: _VT | _T) -> _VT | _T: ... Note the union with two...

Open Graph Description: dict.pop is currently defined as typeshed/stdlib/builtins.pyi Lines 1086 to 1089 in 1851423 @overload def pop(self, __key: _KT) -> _VT: ... @overload def pop(self, __key: _KT, __default: _VT | _T) ...

X Description: dict.pop is currently defined as typeshed/stdlib/builtins.pyi Lines 1086 to 1089 in 1851423 @overload def pop(self, __key: _KT) -> _VT: ... @overload def pop(self, __key: _KT, __default: _VT | _...

Opengraph URL: https://github.com/python/typeshed/issues/10293

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"The type of __default= in dict.pop and dict.get doesn't look right","articleBody":"`dict.pop` is currently defined as \r\n\r\nhttps://github.com/python/typeshed/blob/18514235198637fd2f9a7a92084a73d630da8f17/stdlib/builtins.pyi#L1086-L1089\r\n\r\nNote the union with two type parameters as a type of `__default=`. This type is ambiguous if `dict.pop` is called with a value of type `_VT`. For example, given\r\n\r\n```\r\nd: dict[str, str]\r\nd.pop(\"foo\")\r\n```\r\n\r\na type checker can choose any value for `_T`, since `str` is a subtype of `str | _T` regardless of what `_T` is. \r\n\r\nIt seems the union was introduced in 2fdcd2e9e8e51b138f03df8e0d96e88c4b280110, which unfortunately does not seem to give any reasoning for that. I think we should drop it and use `_T` instead in both `dict.pop` and `dict.get` (and similarly for `MutableMapping`), i.e.\r\n\r\n```\r\nclass dict(Generic[_KT, _VT]):\r\n   # ...\r\n   @overload\r\n   def pop(self, __key: _KT, __default: _T) -> _T: ...\r\n```","author":{"url":"https://github.com/superbobry","@type":"Person","name":"superbobry"},"datePublished":"2023-06-09T19:28:20Z","url":"https://github.com/python/typeshed/issues/10293"}

react-profiling0
react-import-mapreact,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-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:25c899a5-d9e2-25ba-fb9d-5dffe00b05ea
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB3CC:1AC37C:13EC87:1AD934:6B001EDF
html-safe-nonce081b64ad7bfcc89d1b21dca62ca12b7c55bd6d3caf647c5e62fb88535d766ee4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCM0NDOjFBQzM3QzoxM0VDODc6MUFEOTM0OjZCMDAxRURGIiwidmlzaXRvcl9pZCI6IjgwNDMzOTY5Mzg3NzI1MjA2NzEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacca21ccf381d5a529eba6eea192f5e03a16ba96a07fa5b17088210ae639d55217
hovercard-subject-tagissue:1750399232
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/typeshed/10293/issue_layout
twitter:imagehttps://opengraph.githubassets.com/4f6632c618d1a13e699339a7bafc7549ce157a04a2707adda340d151eb16c003/python/typeshed/issues/10293
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/4f6632c618d1a13e699339a7bafc7549ce157a04a2707adda340d151eb16c003/python/typeshed/issues/10293
og:image:altdict.pop is currently defined as typeshed/stdlib/builtins.pyi Lines 1086 to 1089 in 1851423 @overload def pop(self, __key: _KT) -> _VT: ... @overload def pop(self, __key: _KT, __default: _VT | _T) ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesuperbobry
hostnamegithub.com
expected-hostnamegithub.com
None4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0
turbo-cache-controlno-preview
go-importgithub.com/python/typeshed git https://github.com/python/typeshed.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id31696383
octolytics-dimension-repository_nwopython/typeshed
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id31696383
octolytics-dimension-repository_network_root_nwopython/typeshed
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release44c658b24abf00491fb7ae5f56d42c9f38cbeab2
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/typeshed/issues/10293#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftypeshed%2Fissues%2F10293
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftypeshed%2Fissues%2F10293
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=python%2Ftypeshed
Reloadhttps://github.com/python/typeshed/issues/10293
Reloadhttps://github.com/python/typeshed/issues/10293
Reloadhttps://github.com/python/typeshed/issues/10293
pythonhttps://github.com/python
typeshedhttps://github.com/python/typeshed
Codehttps://github.com/python/typeshed
Issues196 (196)https://github.com/python/typeshed/issues
Pull requests251 (251)https://github.com/python/typeshed/pulls
Actionshttps://github.com/python/typeshed/actions
Security and qualityhttps://github.com/python/typeshed/security
Insightshttps://github.com/python/typeshed/insights
https://github.com/python/typeshed
New issuehttps://github.com/login?return_to=https://github.com/python/typeshed/issues/10293
New issuehttps://github.com/login?return_to=https://github.com/python/typeshed/issues/10293
#10501https://github.com/python/typeshed/pull/10501
The type of __default= in dict.pop and dict.get doesn't look righthttps://github.com/python/typeshed/issues/10293#top
#10501https://github.com/python/typeshed/pull/10501
https://github.com/superbobry
superbobryhttps://github.com/superbobry
on Jun 9, 2023https://github.com/python/typeshed/issues/10293#issue-1750399232
typeshed/stdlib/builtins.pyihttps://github.com/python/typeshed/blob/18514235198637fd2f9a7a92084a73d630da8f17/stdlib/builtins.pyi#L1086-L1089
1851423https://github.com/python/typeshed/commit/18514235198637fd2f9a7a92084a73d630da8f17
2fdcd2ehttps://github.com/python/typeshed/commit/2fdcd2e9e8e51b138f03df8e0d96e88c4b280110
https://github.com/JelleZijlstra
JelleZijlstrahttps://github.com/JelleZijlstra
on Jun 9, 2023https://github.com/python/typeshed/issues/10293#issuecomment-1585043162
https://github.com/superbobry
superbobryhttps://github.com/superbobry
on Jun 9, 2023https://github.com/python/typeshed/issues/10293#issuecomment-1585044659
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
on Jun 9, 2023https://github.com/python/typeshed/issues/10293#issuecomment-1585046507
https://github.com/superbobry
superbobryhttps://github.com/superbobry
on Jun 9, 2023https://github.com/python/typeshed/issues/10293#issuecomment-1585071901
https://github.com/superbobry
superbobryhttps://github.com/superbobry
on Jun 9, 2023https://github.com/python/typeshed/issues/10293#issuecomment-1585080061
superbobryhttps://github.com/superbobry
on Jun 9, 2023https://github.com/python/typeshed/issues/10293#event-9487980685
Remove unnecessary union in the default type in .get() and .pop() met…https://github.com/superbobry/typeshed/commit/23f0d998c0343c2b955255d3407d0ffd1c645431
https://docs.github.com/articles/closing-issues-via-commit-messages
23f0d99https://github.com/superbobry/typeshed/commit/23f0d998c0343c2b955255d3407d0ffd1c645431
Remove unnecessary union in the default type in .get() and .pop() met…https://github.com/superbobry/typeshed/commit/ed515694db69c8a1534dae0317b57d78a00e2e10
https://docs.github.com/articles/closing-issues-via-commit-messages
ed51569https://github.com/superbobry/typeshed/commit/ed515694db69c8a1534dae0317b57d78a00e2e10
Remove unnecessary union in the default type in .get() and .pop() met…https://github.com/superbobry/typeshed/commit/8b7e2fb2333c9da462881042d171a2a6918ed713
https://docs.github.com/articles/closing-issues-via-commit-messages
8b7e2fbhttps://github.com/superbobry/typeshed/commit/8b7e2fb2333c9da462881042d171a2a6918ed713
Remove unnecessary union in the default type in .get() and .pop() met…https://github.com/superbobry/typeshed/commit/d56754cdf48f81d14e97bbc63c0d5105e4787f73
https://docs.github.com/articles/closing-issues-via-commit-messages
d56754chttps://github.com/superbobry/typeshed/commit/d56754cdf48f81d14e97bbc63c0d5105e4787f73
eltoderhttps://github.com/eltoder
on Jul 22, 2023https://github.com/python/typeshed/issues/10293#event-9891729331
More precise overloads for get/pop methodshttps://github.com/eltoder/typeshed/commit/39ae075acfcc0cba07679aee918e5517992d7c5a
https://docs.github.com/articles/closing-issues-via-commit-messages
39ae075https://github.com/eltoder/typeshed/commit/39ae075acfcc0cba07679aee918e5517992d7c5a
More precise overloads for get/pop methodshttps://github.com/eltoder/typeshed/commit/8be6bd57b52174eb5b4b66923a9e59092b0357f5
https://docs.github.com/articles/closing-issues-via-commit-messages
8be6bd5https://github.com/eltoder/typeshed/commit/8be6bd57b52174eb5b4b66923a9e59092b0357f5
AlexWaygoodhttps://github.com/AlexWaygood
completedhttps://github.com/python/typeshed/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#10501https://github.com/python/typeshed/pull/10501
on Jul 26, 2023https://github.com/python/typeshed/issues/10293#event-9925857623
AlexWaygoodhttps://github.com/AlexWaygood
on Jul 26, 2023https://github.com/python/typeshed/issues/10293#event-9925857896
More precise overloads for get/pop methods (#10501)https://github.com/python/typeshed/commit/e86c61da86f564b39a8c4415a2d513758e62b0fd
#10501https://github.com/python/typeshed/pull/10501
https://docs.github.com/articles/closing-issues-via-commit-messages
e86c61dhttps://github.com/python/typeshed/commit/e86c61da86f564b39a8c4415a2d513758e62b0fd
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/typeshed/issues/10293
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/typeshed/issues/10293
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.