René's URL Explorer Experiment


Title: Infer attributes from __new__ · Issue #1021 · python/mypy · GitHub

Open Graph Title: Infer attributes from __new__ · Issue #1021 · python/mypy

X Title: Infer attributes from __new__ · Issue #1021 · python/mypy

Description: In this example (from #982) we define an attribute via assignment in __new__: class C(object): def __new__(cls, foo=None): obj = object.__new__(cls) obj.foo = foo return obj x = C(foo=12) print(x.foo) Currently mypy doesn't recognize att...

Open Graph Description: In this example (from #982) we define an attribute via assignment in __new__: class C(object): def __new__(cls, foo=None): obj = object.__new__(cls) obj.foo = foo return obj x = C(foo=12) print(x.f...

X Description: In this example (from #982) we define an attribute via assignment in __new__: class C(object): def __new__(cls, foo=None): obj = object.__new__(cls) obj.foo = foo return obj x = C(foo=12) print(x.f...

Opengraph URL: https://github.com/python/mypy/issues/1021

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Infer attributes from __new__","articleBody":"In this example (from #982) we define an attribute via assignment in `__new__`:\n\n```\nclass C(object):\n    def __new__(cls, foo=None):\n        obj = object.__new__(cls)\n        obj.foo = foo\n        return obj\n\nx = C(foo=12)\nprint(x.foo)\n```\n\nCurrently mypy doesn't recognize attribute `foo` and complains about `x.foo`. To implement this, we could do these things:\n- Infer the fact that `obj` is something similar to `self` because of the way is created via `object.__new__`. This should happen during semantic analysis so that this will work in unannotated method as well.\n- Infer attributes from assignments via `obj` because it is classified as similar to `self`.\n- Also recognize `object.__new__` calls via `super(...)`.\n","author":{"url":"https://github.com/JukkaL","@type":"Person","name":"JukkaL"},"datePublished":"2015-11-29T20:44:42Z","url":"https://github.com/python/mypy/issues/1021"}

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:2a1be2a6-9b63-09f0-299c-187699b2e613
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idAF98:30E5B0:3252422:429D101:6B0032D9
html-safe-nonced2ca5cd101afa6adbdd1125d398205384995ef26205f5c6659a929cdc5eb4c0a
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBRjk4OjMwRTVCMDozMjUyNDIyOjQyOUQxMDE6NkIwMDMyRDkiLCJ2aXNpdG9yX2lkIjoiMzI2OTE3ODQxODU4Mjc5NDk2OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacf30dd497428f6f807790870cae3210ed88916f5e8912a5c88ab0f1c70c3a1456
hovercard-subject-tagissue:119387016
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/mypy/1021/issue_layout
twitter:imagehttps://opengraph.githubassets.com/d164005b22b5a9e3918412d101a98a31bfb74174ebe1c4c99d6bc23110a0bf74/python/mypy/issues/1021
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/d164005b22b5a9e3918412d101a98a31bfb74174ebe1c4c99d6bc23110a0bf74/python/mypy/issues/1021
og:image:altIn this example (from #982) we define an attribute via assignment in __new__: class C(object): def __new__(cls, foo=None): obj = object.__new__(cls) obj.foo = foo return obj x = C(foo=12) print(x.f...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameJukkaL
hostnamegithub.com
expected-hostnamegithub.com
None7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0
turbo-cache-controlno-preview
go-importgithub.com/python/mypy git https://github.com/python/mypy.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id7053637
octolytics-dimension-repository_nwopython/mypy
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id7053637
octolytics-dimension-repository_network_root_nwopython/mypy
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
releasef3f3a43ca095cdea3abbb394112e971f9fdb94fa
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/mypy/issues/1021#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F1021
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%2Fmypy%2Fissues%2F1021
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%2Fmypy
Reloadhttps://github.com/python/mypy/issues/1021
Reloadhttps://github.com/python/mypy/issues/1021
Reloadhttps://github.com/python/mypy/issues/1021
pythonhttps://github.com/python
mypyhttps://github.com/python/mypy
Codehttps://github.com/python/mypy
Issues2.7k (2.7k)https://github.com/python/mypy/issues
Pull requests546 (546)https://github.com/python/mypy/pulls
Actionshttps://github.com/python/mypy/actions
Projectshttps://github.com/python/mypy/projects
Wikihttps://github.com/python/mypy/wiki
Security and qualityhttps://github.com/python/mypy/security
Insightshttps://github.com/python/mypy/insights
https://github.com/python/mypy
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/1021
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/1021
Infer attributes from __new__https://github.com/python/mypy/issues/1021#top
false-positivemypy gave an error on correct codehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22false-positive%22
featurehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22feature%22
priority-0-highhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-0-high%22
https://github.com/JukkaL
JukkaLhttps://github.com/JukkaL
on Nov 29, 2015https://github.com/python/mypy/issues/1021#issue-119387016
#982https://github.com/python/mypy/issues/982
JukkaLhttps://github.com/JukkaL
featurehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22feature%22
on Nov 29, 2015https://github.com/python/mypy/issues/1021#event-477177490
https://github.com/JukkaL
JukkaLhttps://github.com/JukkaL
on Nov 29, 2015https://github.com/python/mypy/issues/1021#issuecomment-160469775
#982https://github.com/python/mypy/issues/982
gvanrossumhttps://github.com/gvanrossum
priority-0-highhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-0-high%22
on Apr 28, 2017https://github.com/python/mypy/issues/1021#event-1061357717
JukkaLhttps://github.com/JukkaL
priority-1-normalhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-1-normal%22
false-positivemypy gave an error on correct codehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22false-positive%22
priority-0-highhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-0-high%22
on May 18, 2018https://github.com/python/mypy/issues/1021#event-1635064824
https://github.com/JukkaL
JukkaLhttps://github.com/JukkaL
on May 18, 2018https://github.com/python/mypy/issues/1021#issuecomment-390319586
https://github.com/toolforger
toolforgerhttps://github.com/toolforger
on Jun 11, 2018https://github.com/python/mypy/issues/1021#issuecomment-396386736
https://github.com/JelleZijlstra
JelleZijlstrahttps://github.com/JelleZijlstra
on Jun 11, 2018https://github.com/python/mypy/issues/1021#issuecomment-396387201
@toolforgerhttps://github.com/toolforger
https://github.com/toolforger
toolforgerhttps://github.com/toolforger
on Jun 11, 2018https://github.com/python/mypy/issues/1021#issuecomment-396388876
#5194https://github.com/python/mypy/issues/5194
#1279https://github.com/python/mypy/issues/1279
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Jun 11, 2018https://github.com/python/mypy/issues/1021#issuecomment-396402792
https://github.com/toolforger
toolforgerhttps://github.com/toolforger
on Jun 12, 2018https://github.com/python/mypy/issues/1021#issuecomment-396472667
@ilevkivskyihttps://github.com/ilevkivskyi
https://github.com/gvanrossum
gvanrossumhttps://github.com/gvanrossum
on Jun 12, 2018https://github.com/python/mypy/issues/1021#issuecomment-396641623
@toolforgerhttps://github.com/toolforger
https://github.com/toolforger
toolforgerhttps://github.com/toolforger
on Jun 12, 2018https://github.com/python/mypy/issues/1021#issuecomment-396682247
https://github.com/gvanrossum
gvanrossumhttps://github.com/gvanrossum
on Feb 19, 2019https://github.com/python/mypy/issues/1021#issuecomment-465183785
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Feb 19, 2019https://github.com/python/mypy/issues/1021#issuecomment-465189570
https://github.com/gvanrossum
gvanrossumhttps://github.com/gvanrossum
on Feb 19, 2019https://github.com/python/mypy/issues/1021#issuecomment-465198394
JukkaLhttps://github.com/JukkaL
priority-0-highhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-0-high%22
priority-1-normalhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-1-normal%22
on Feb 19, 2019https://github.com/python/mypy/issues/1021#event-2149399700
https://github.com/JukkaL
JukkaLhttps://github.com/JukkaL
on Feb 19, 2019https://github.com/python/mypy/issues/1021#issuecomment-465204103
https://github.com/mjpieters
mjpietershttps://github.com/mjpieters
on Mar 17, 2021https://github.com/python/mypy/issues/1021#issuecomment-801195574
Crimson-Crowhttps://github.com/Crimson-Crow
on Jun 28, 2021https://github.com/python/mypy/issues/1021#event-4950245153
python/mypy#1021 workaround fixhttps://github.com/Crimson-Crow/pyobservable/commit/2e47c521acb87b59a63c6b4618fc1fb44c951830
python/mypy#1021https://github.com/python/mypy/issues/1021
2e47c52https://github.com/Crimson-Crow/pyobservable/commit/2e47c521acb87b59a63c6b4618fc1fb44c951830
https://github.com/tpvasconcelos
tpvasconceloshttps://github.com/tpvasconcelos
on Nov 23, 2021https://github.com/python/mypy/issues/1021#issuecomment-976637400
https://github.com/berzi
berzihttps://github.com/berzi
on Aug 21, 2022https://github.com/python/mypy/issues/1021#issuecomment-1221547648
@tpvasconceloshttps://github.com/tpvasconcelos
https://github.com/alexei
alexeihttps://github.com/alexei
on Sep 7, 2023https://github.com/python/mypy/issues/1021#issuecomment-1710702222
https://github.com/brianmedigate
brianmedigatehttps://github.com/brianmedigate
on Oct 15, 2024https://github.com/python/mypy/issues/1021#issuecomment-2414822748
https://github.com/garkin
garkinhttps://github.com/garkin
on Dec 12, 2024https://github.com/python/mypy/issues/1021#issuecomment-2537832137
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/mypy/issues/1021
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/mypy/issues/1021
false-positivemypy gave an error on correct codehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22false-positive%22
featurehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22feature%22
priority-0-highhttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22priority-0-high%22
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.