René's URL Explorer Experiment


Title: Support exhaustiveness checking for 'in' statements (enums) · Issue #16093 · python/mypy · GitHub

Open Graph Title: Support exhaustiveness checking for 'in' statements (enums) · Issue #16093 · python/mypy

X Title: Support exhaustiveness checking for 'in' statements (enums) · Issue #16093 · python/mypy

Description: Feature Allow the use of the in statement when doing exhaustiveness checking. from enum import Enum from typing import assert_never class MyEnum(Enum): A = 1 B = 2 C = 3 def my_function(a: MyEnum) -> bool: if a == MyEnum.A: return True e...

Open Graph Description: Feature Allow the use of the in statement when doing exhaustiveness checking. from enum import Enum from typing import assert_never class MyEnum(Enum): A = 1 B = 2 C = 3 def my_function(a: MyEnum) ...

X Description: Feature Allow the use of the in statement when doing exhaustiveness checking. from enum import Enum from typing import assert_never class MyEnum(Enum): A = 1 B = 2 C = 3 def my_function(a: MyEnum) ...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support exhaustiveness checking for 'in' statements (enums)","articleBody":"**Feature**\r\n\r\nAllow the use of the `in` statement when doing exhaustiveness checking.\r\n\r\n```python\r\nfrom enum import Enum\r\nfrom typing import assert_never\r\n\r\n\r\nclass MyEnum(Enum):\r\n    A = 1\r\n    B = 2\r\n    C = 3 \r\n\r\n\r\ndef my_function(a: MyEnum) -> bool:\r\n    if a == MyEnum.A:\r\n        return True\r\n    elif a in (MyEnum.B, MyEnum.C):\r\n        return False\r\n    assert_never(a)\r\n\r\n\r\nmy_function(MyEnum.A)\r\n\r\n```\r\n\r\nCurrently, this will raise the following exception:\r\n```\r\nerror: Argument 1 to \"assert_never\" has incompatible type\r\n\"Literal[MyEnum.B, MyEnum.C]\"; expected \"NoReturn\"  [arg-type]\r\n        assert_never(a)\r\n```\r\n\r\nwhere the following would not:\r\n\r\n```python\r\ndef my_function(a: MyEnum) -> bool:\r\n    if a == MyEnum.A:\r\n        return True\r\n    elif a == MyEnum.B:\r\n        return False\r\n    elif a == MyEnum.C:\r\n        return False\r\n    assert_never(a)\r\n```\r\n\r\n**Pitch**\r\n\r\nIf you wish to do the same thing for multiple enums in that particular function and also want exhaustiveness checking, you need to type each case out individually and then return the same thing, which is not great (DRY etc...).\r\n","author":{"url":"https://github.com/chrisbeardy","@type":"Person","name":"chrisbeardy"},"datePublished":"2023-09-12T09:28:04Z","url":"https://github.com/python/mypy/issues/16093"}

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:d6657302-0420-d4d6-c87d-9f94b2ca0cdc
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id8C7A:12476C:1BFB588:24DD23B:6B002A21
html-safe-noncefbc5b69c3c03af0be982a718c3fc8a73a1b855d47f7e0951f630ad548ffc01c7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QzdBOjEyNDc2QzoxQkZCNTg4OjI0REQyM0I6NkIwMDJBMjEiLCJ2aXNpdG9yX2lkIjoiMzQ2MzAxNTkxMzc0MDE1MDA5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac41ae43124303fa566cd677916dba37f5efae3ca784135e00770f535fadbfe0b4
hovercard-subject-tagissue:1892078601
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/16093/issue_layout
twitter:imagehttps://opengraph.githubassets.com/1dfe3316b057a337529d4adc0cb14f6a26dc2a68213f659084ae6ece5dc274f8/python/mypy/issues/16093
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/1dfe3316b057a337529d4adc0cb14f6a26dc2a68213f659084ae6ece5dc274f8/python/mypy/issues/16093
og:image:altFeature Allow the use of the in statement when doing exhaustiveness checking. from enum import Enum from typing import assert_never class MyEnum(Enum): A = 1 B = 2 C = 3 def my_function(a: MyEnum) ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamechrisbeardy
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/16093#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fissues%2F16093
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%2F16093
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/16093
Reloadhttps://github.com/python/mypy/issues/16093
Reloadhttps://github.com/python/mypy/issues/16093
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 requests547 (547)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/16093
New issuehttps://github.com/login?return_to=https://github.com/python/mypy/issues/16093
#21456https://github.com/python/mypy/pull/21456
Malika1109/mypy#3https://github.com/Malika1109/mypy/pull/3
Support exhaustiveness checking for 'in' statements (enums)https://github.com/python/mypy/issues/16093#top
#21456https://github.com/python/mypy/pull/21456
Malika1109/mypy#3https://github.com/Malika1109/mypy/pull/3
featurehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22feature%22
https://github.com/chrisbeardy
chrisbeardyhttps://github.com/chrisbeardy
on Sep 12, 2023https://github.com/python/mypy/issues/16093#issue-1892078601
chrisbeardyhttps://github.com/chrisbeardy
featurehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22feature%22
on Sep 12, 2023https://github.com/python/mypy/issues/16093#event-10344206435
https://github.com/JelleZijlstra
JelleZijlstrahttps://github.com/JelleZijlstra
on Sep 21, 2023https://github.com/python/mypy/issues/16093#issuecomment-1730208765
@bucknathanaelhttps://github.com/bucknathanael
https://github.com/cj81499
cj81499https://github.com/cj81499
on Jun 7, 2024https://github.com/python/mypy/issues/16093#issuecomment-2155167577
#12535https://github.com/python/mypy/issues/12535
hauntsaninjahttps://github.com/hauntsaninja
completedhttps://github.com/python/mypy/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#21456https://github.com/python/mypy/pull/21456
on May 11, 2026https://github.com/python/mypy/issues/16093#event-25368549625
hauntsaninjahttps://github.com/hauntsaninja
on May 11, 2026https://github.com/python/mypy/issues/16093#event-25368549650
Improve negative narrowing for membership checks on tuples (#21456)https://github.com/python/mypy/commit/a9008315ef56aa3843b957d372989f455acdd7bb
#21456https://github.com/python/mypy/pull/21456
https://docs.github.com/articles/closing-issues-via-commit-messages
a900831https://github.com/python/mypy/commit/a9008315ef56aa3843b957d372989f455acdd7bb
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/mypy/issues/16093
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/mypy/issues/16093
featurehttps://github.com/python/mypy/issues?q=state%3Aopen%20label%3A%22feature%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.