René's URL Explorer Experiment


Title: Type guard doesn't intersect types like instance check · Issue #1351 · python/typing · GitHub

Open Graph Title: Type guard doesn't intersect types like instance check · Issue #1351 · python/typing

X Title: Type guard doesn't intersect types like instance check · Issue #1351 · python/typing

Description: The type guard doesn't seem to work like an instance check: from typing import TypeGuard, Any class X: pass class Y: pass x: X = X() assert isinstance(x, Y) def f(z: Any) -> TypeGuard[Y]: return isinstance(z, Y) reveal_type(x) # Revealed...

Open Graph Description: The type guard doesn't seem to work like an instance check: from typing import TypeGuard, Any class X: pass class Y: pass x: X = X() assert isinstance(x, Y) def f(z: Any) -> TypeGuard[Y]: return is...

X Description: The type guard doesn't seem to work like an instance check: from typing import TypeGuard, Any class X: pass class Y: pass x: X = X() assert isinstance(x, Y) def f(z: Any) -> TypeGuard[Y]: re...

Opengraph URL: https://github.com/python/typing/issues/1351

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Type guard doesn't intersect types like instance check","articleBody":"The type guard doesn't seem to work like an instance check:\r\n```python\r\nfrom typing import TypeGuard, Any\r\nclass X: pass\r\nclass Y: pass\r\nx: X = X()\r\nassert isinstance(x, Y)\r\ndef f(z: Any) -> TypeGuard[Y]:\r\n    return isinstance(z, Y)\r\nreveal_type(x)  # Revealed type is \"a.\u003csubclass of \"X\" and \"Y\">\", which is great!\r\nx2: X\r\nassert f(x2)\r\nreveal_type(x2)  # Revealed type is \"a.Y\", which is unfortunate.\r\n```\r\nThis is causing problems with the definition of `dataclasses.is_dataclass` https://github.com/python/typeshed/issues/9723.\r\n\r\nThe above code was tested with MyPy and Pyright.","author":{"url":"https://github.com/NeilGirdhar","@type":"Person","name":"NeilGirdhar"},"datePublished":"2023-02-18T18:18:48Z","url":"https://github.com/python/typing/issues/1351"}

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:295a59b6-9e7d-e5d2-d9d5-6c913c83f34b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB0A4:326AD2:293D78:395955:6B008910
html-safe-nonce1bf7b05f1a887e12ca2d82724d2c9aea9757c604d13e503c5cad97edbb29319d
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMEE0OjMyNkFEMjoyOTNENzg6Mzk1OTU1OjZCMDA4OTEwIiwidmlzaXRvcl9pZCI6Ijg5MDEwODQ0OTE2OTEzNjI1NzYiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmac5c62f2c05700e0ea04b126d4a67236b5252119998b12a9b368f180db81226b31
hovercard-subject-tagissue:1590427495
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/typing/1351/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1db1dda68603019cff254f1d7cde2c3bfc9ddace9c4692181c3f30505870ddd0/python/typing/issues/1351
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1db1dda68603019cff254f1d7cde2c3bfc9ddace9c4692181c3f30505870ddd0/python/typing/issues/1351
og:image:altThe type guard doesn't seem to work like an instance check: from typing import TypeGuard, Any class X: pass class Y: pass x: X = X() assert isinstance(x, Y) def f(z: Any) -> TypeGuard[Y]: return is...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameNeilGirdhar
hostnamegithub.com
expected-hostnamegithub.com
None4d3d8e50f02c1d7bf86d5acfa1d3bfe9366abd6528a6b429eb07a168429d2b61
turbo-cache-controlno-preview
go-importgithub.com/python/typing git https://github.com/python/typing.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id24604008
octolytics-dimension-repository_nwopython/typing
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id24604008
octolytics-dimension-repository_network_root_nwopython/typing
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
releasedb758f8e02b8257935fb03edf81a3e76eb3abd11
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/typing/issues/1351#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftyping%2Fissues%2F1351
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%2Ftyping%2Fissues%2F1351
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%2Ftyping
Reloadhttps://github.com/python/typing/issues/1351
Reloadhttps://github.com/python/typing/issues/1351
Reloadhttps://github.com/python/typing/issues/1351
pythonhttps://github.com/python
typinghttps://github.com/python/typing
Codehttps://github.com/python/typing
Issues206 (206)https://github.com/python/typing/issues
Pull requests27 (27)https://github.com/python/typing/pulls
Discussionshttps://github.com/python/typing/discussions
Actionshttps://github.com/python/typing/actions
Security and qualityhttps://github.com/python/typing/security
Insightshttps://github.com/python/typing/insights
https://github.com/python/typing
New issuehttps://github.com/login?return_to=https://github.com/python/typing/issues/1351
New issuehttps://github.com/login?return_to=https://github.com/python/typing/issues/1351
Type guard doesn't intersect types like instance checkhttps://github.com/python/typing/issues/1351#top
topic: otherOther topics not coveredhttps://github.com/python/typing/issues?q=state%3Aopen%20label%3A%22topic%3A%20other%22
https://github.com/NeilGirdhar
NeilGirdharhttps://github.com/NeilGirdhar
on Feb 18, 2023https://github.com/python/typing/issues/1351#issue-1590427495
python/typeshed#9723https://github.com/python/typeshed/issues/9723
NeilGirdharhttps://github.com/NeilGirdhar
topic: otherOther topics not coveredhttps://github.com/python/typing/issues?q=state%3Aopen%20label%3A%22topic%3A%20other%22
on Feb 18, 2023https://github.com/python/typing/issues/1351#event-8553645523
https://github.com/JelleZijlstra
JelleZijlstrahttps://github.com/JelleZijlstra
on Feb 18, 2023https://github.com/python/typing/issues/1351#issuecomment-1435740019
https://peps.python.org/pep-0647/#typeguard-typehttps://peps.python.org/pep-0647/#typeguard-type
https://github.com/NeilGirdhar
NeilGirdharhttps://github.com/NeilGirdhar
on Feb 18, 2023https://github.com/python/typing/issues/1351#issuecomment-1435741473
https://github.com/JelleZijlstra
JelleZijlstrahttps://github.com/JelleZijlstra
on Feb 18, 2023https://github.com/python/typing/issues/1351#issuecomment-1435742379
https://mail.python.org/archives/list/typing-sig@python.org/thread/JTO3WKRKQFW5YFP3ZSMNTRIEA5NPJEM6/https://mail.python.org/archives/list/typing-sig@python.org/thread/JTO3WKRKQFW5YFP3ZSMNTRIEA5NPJEM6/
https://github.com/NeilGirdhar
NeilGirdharhttps://github.com/NeilGirdhar
on Feb 18, 2023https://github.com/python/typing/issues/1351#issuecomment-1435757816
@msfterictrauthttps://github.com/msfterictraut
https://github.com/erictraut
erictrauthttps://github.com/erictraut
on Feb 18, 2023https://github.com/python/typing/issues/1351#issuecomment-1435760607
@NeilGirdharhttps://github.com/NeilGirdhar
https://github.com/NeilGirdhar
NeilGirdharhttps://github.com/NeilGirdhar
on Feb 18, 2023https://github.com/python/typing/issues/1351#issuecomment-1435761562
https://github.com/erictraut
erictrauthttps://github.com/erictraut
on Feb 18, 2023https://github.com/python/typing/issues/1351#issuecomment-1435762960
https://github.com/NeilGirdhar
NeilGirdharhttps://github.com/NeilGirdhar
on Feb 18, 2023https://github.com/python/typing/issues/1351#issuecomment-1435764753
is_dataclasshttps://docs.python.org/3/library/dataclasses.html#dataclasses.is_dataclass
tested that herehttps://github.com/python/typeshed/issues/9723#issuecomment-1435769178
https://github.com/erictraut
erictrauthttps://github.com/erictraut
on Feb 19, 2023https://github.com/python/typing/issues/1351#issuecomment-1435803234
https://github.com/NeilGirdhar
NeilGirdharhttps://github.com/NeilGirdhar
on Feb 19, 2023https://github.com/python/typing/issues/1351#issuecomment-1435812739
https://github.com/erictraut
erictrauthttps://github.com/erictraut
on Feb 20, 2023https://github.com/python/typing/issues/1351#issuecomment-1436320730
https://github.com/kmillikin
kmillikinhttps://github.com/kmillikin
on Feb 20, 2023https://github.com/python/typing/issues/1351#issuecomment-1437035676
@NeilGirdharhttps://github.com/NeilGirdhar
https://github.com/kmillikin
kmillikinhttps://github.com/kmillikin
on Feb 20, 2023https://github.com/python/typing/issues/1351#issuecomment-1437258992
https://github.com/kmillikin
kmillikinhttps://github.com/kmillikin
on Feb 21, 2023https://github.com/python/typing/issues/1351#issuecomment-1438602981
https://github.com/NeilGirdhar
NeilGirdharhttps://github.com/NeilGirdhar
on Feb 21, 2023https://github.com/python/typing/issues/1351#issuecomment-1438957777
@erictrauthttps://github.com/erictraut
@kmillikinhttps://github.com/kmillikin
herehttps://github.com/python/typing/issues/1351#issuecomment-1438602981
https://github.com/NeilGirdhar
NeilGirdharhttps://github.com/NeilGirdhar
on Sep 19, 2023https://github.com/python/typing/issues/1351#issuecomment-1726382787
PEP 724https://discuss.python.org/t/pep-724-stricter-type-guards/34124
https://github.com/KotlinIsland
KotlinIslandhttps://github.com/KotlinIsland
on Oct 19, 2023https://github.com/python/typing/issues/1351#issuecomment-1771853763
https://kotlinisland.github.io/basedmypy/based_features.html#reinvented-type-guardshttps://kotlinisland.github.io/basedmypy/based_features.html#reinvented-type-guards
https://github.com/erictraut
erictrauthttps://github.com/erictraut
on May 17, 2024https://github.com/python/typing/issues/1351#issuecomment-2116602742
hauntsaninjahttps://github.com/hauntsaninja
completedhttps://github.com/python/typing/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on May 17, 2024https://github.com/python/typing/issues/1351#event-12842674241
https://github.com/bluenote10
bluenote10https://github.com/bluenote10
on May 17, 2024https://github.com/python/typing/issues/1351#issuecomment-2117075175
section on TypeIshttps://github.com/python/typing/blob/main/docs/spec/narrowing.rst#typeis
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/typing/issues/1351
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/typing/issues/1351
topic: otherOther topics not coveredhttps://github.com/python/typing/issues?q=state%3Aopen%20label%3A%22topic%3A%20other%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.