René's URL Explorer Experiment


Title: Enables the narrowing of variable types when checking a variable is "in" a collection. by Jordandev678 · Pull Request #17344 · python/mypy · GitHub

Open Graph Title: Enables the narrowing of variable types when checking a variable is "in" a collection. by Jordandev678 · Pull Request #17344 · python/mypy

X Title: Enables the narrowing of variable types when checking a variable is "in" a collection. by Jordandev678 · Pull Request #17344 · python/mypy

Description: Optional static typing for Python. Contribute to python/mypy development by creating an account on GitHub.

Open Graph Description: Enables the narrowing of variable types when checking a variable is "in" a collection, and the collection type is a subtype of the variable type. Fixes #3229 (Explain how this PR changes ...

X Description: Enables the narrowing of variable types when checking a variable is "in" a collection, and the collection type is a subtype of the variable type. Fixes #3229 (Explain how this PR ...

Opengraph URL: https://github.com/python/mypy/pull/17344

X: @github

direct link

Domain: github.com

route-pattern/_view_fragments/voltron/pull_requests/show/:user_id/:repository/:id/pull_request_layout(.:format)
route-controllervoltron_pull_requests_fragments
route-actionpull_request_layout
fetch-noncev2:b123e45f-2527-ff89-ee62-a32fcc6df360
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idA5B4:4B803:2225392:2DBD7C1:6A599335
html-safe-noncecdd3cad6b03e3adc2f9fc28ceb5b67b208d29fd819ac0df0fd40884ad32775c0
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNUI0OjRCODAzOjIyMjUzOTI6MkRCRDdDMTo2QTU5OTMzNSIsInZpc2l0b3JfaWQiOiI0ODE3ODUyMzc0NjM0MzA0MzA5IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac30c7754e9ee5f60c711ce14fff1630323a5f878f703e13999157b7c4896ee507
hovercard-subject-tagpull_request:1909936461
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/pull_requests_fragments/pull_request_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/voltron/pull_requests/show/python/mypy/17344/pull_request_layout
twitter:imagehttps://opengraph.githubassets.com/aef6a8f5ff3177141742ac0e7beee51bdd88d957c2e3bba359067e70ba348374/python/mypy/pull/17344
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/aef6a8f5ff3177141742ac0e7beee51bdd88d957c2e3bba359067e70ba348374/python/mypy/pull/17344
og:image:altEnables the narrowing of variable types when checking a variable is "in" a collection, and the collection type is a subtype of the variable type. Fixes #3229 (Explain how this PR changes ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameJordandev678
hostnamegithub.com
expected-hostnamegithub.com
Nonea540949572872b935b393b36db38922db390ae71c859537d741b8f3eb7e545b5
turbo-cache-controlno-cache
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
release624bb50a7497aa346bef8cc3743af408a9ea10ca
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/python/mypy/pull/17344#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F17344
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F17344
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fpull_requests_fragments%2Fpull_request_layout&source=header-repo&source_repo=python%2Fmypy
Reloadhttps://github.com/python/mypy/pull/17344
Reloadhttps://github.com/python/mypy/pull/17344
Reloadhttps://github.com/python/mypy/pull/17344
Please reload this pagehttps://github.com/python/mypy/pull/17344
python https://github.com/python
mypyhttps://github.com/python/mypy
Please reload this pagehttps://github.com/python/mypy/pull/17344
Notifications https://github.com/login?return_to=%2Fpython%2Fmypy
Fork 3.2k https://github.com/login?return_to=%2Fpython%2Fmypy
Star 20.5k https://github.com/login?return_to=%2Fpython%2Fmypy
Code https://github.com/python/mypy
Issues 2.7k https://github.com/python/mypy/issues
Pull requests 466 https://github.com/python/mypy/pulls
Actions https://github.com/python/mypy/actions
Projects https://github.com/python/mypy/projects
Wiki https://github.com/python/mypy/wiki
Security and quality 0 https://github.com/python/mypy/security
Insights https://github.com/python/mypy/pulse
Code https://github.com/python/mypy
Issues https://github.com/python/mypy/issues
Pull requests https://github.com/python/mypy/pulls
Actions https://github.com/python/mypy/actions
Projects https://github.com/python/mypy/projects
Wiki https://github.com/python/mypy/wiki
Security and quality https://github.com/python/mypy/security
Insights https://github.com/python/mypy/pulse
hauntsaninjahttps://github.com/hauntsaninja
python:masterhttps://github.com/python/mypy/tree/master
Jordandev678:innarrowinghttps://github.com/Jordandev678/mypy/tree/innarrowing
Conversationhttps://github.com/python/mypy/pull/17344
Commits7 (7)https://github.com/python/mypy/pull/17344/commits
Checkshttps://github.com/python/mypy/pull/17344/checks
Files changedhttps://github.com/python/mypy/pull/17344/files
Enables the narrowing of variable types when checking a variable is "in" a collection.https://github.com/python/mypy/pull/17344#top
hauntsaninjahttps://github.com/hauntsaninja
python:masterhttps://github.com/python/mypy/tree/master
Jordandev678:innarrowinghttps://github.com/Jordandev678/mypy/tree/innarrowing
https://github.com/Jordandev678
Jordandev678https://github.com/Jordandev678
Jun 7, 2024https://github.com/python/mypy/pull/17344#issue-2341247542
#3229https://github.com/python/mypy/issues/3229
Please reload this pagehttps://github.com/python/mypy/pull/17344
Jordandev678https://github.com/Jordandev678
June 7, 2024 19:32https://github.com/python/mypy/pull/17344#commits-pushed-fd85e87
https://github.com/Jordandev678
Enable narrowing types using the "in" operatorhttps://github.com/python/mypy/pull/17344/commits/fd85e8753eeb6906c2dbfcfb9d627e02abbfe912
fd85e87https://github.com/python/mypy/pull/17344/commits/fd85e8753eeb6906c2dbfcfb9d627e02abbfe912
https://github.com/Jordandev678
Add test case fromhttps://github.com/python/mypy/pull/17344/commits/3783f1d07d253425b4d8090e56656688433a696b
python#3229https://github.com/python/mypy/issues/3229
3783f1dhttps://github.com/python/mypy/pull/17344/commits/3783f1d07d253425b4d8090e56656688433a696b
https://github.com/Jordandev678
Add list to narrowing.pyi for testTypeNarrowingStringInListhttps://github.com/python/mypy/pull/17344/commits/dae707d92357c13fef85af49796d341cfbbaabc8
dae707dhttps://github.com/python/mypy/pull/17344/commits/dae707d92357c13fef85af49796d341cfbbaabc8
https://github.com/marketplace/pre-commit-ci
[pre-commit.ci] auto fixes from pre-commit.com hookshttps://github.com/python/mypy/pull/17344/commits/0c10969283124465e9c3a50d8f0ef8a68e4502fe
0c10969https://github.com/python/mypy/pull/17344/commits/0c10969283124465e9c3a50d8f0ef8a68e4502fe
https://pre-commit.cihttps://pre-commit.ci
https://github.com/apps/github-actions
Sign in to viewhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F17344
Jordandev678https://github.com/Jordandev678
June 8, 2024 09:40https://github.com/python/mypy/pull/17344#commits-pushed-800741a
https://github.com/Jordandev678
Don't update if_map if item_type == collection_item_typehttps://github.com/python/mypy/pull/17344/commits/800741a38f10c10dda98cac3b3f1de477bcf1cfd
800741ahttps://github.com/python/mypy/pull/17344/commits/800741a38f10c10dda98cac3b3f1de477bcf1cfd
https://github.com/Jordandev678
Merge branch 'master' into innarrowinghttps://github.com/python/mypy/pull/17344/commits/8c86ce14da2dacc63084e3b904ccc1ee9dd490a7
8c86ce1https://github.com/python/mypy/pull/17344/commits/8c86ce14da2dacc63084e3b904ccc1ee9dd490a7
https://github.com/marketplace/pre-commit-ci
[pre-commit.ci] auto fixes from pre-commit.com hookshttps://github.com/python/mypy/pull/17344/commits/0bb56898805e16a7e00cc483eefa5250f289ef5d
0bb5689https://github.com/python/mypy/pull/17344/commits/0bb56898805e16a7e00cc483eefa5250f289ef5d
https://pre-commit.cihttps://pre-commit.ci
https://github.com/apps/github-actions
github-actionshttps://github.com/apps/github-actions
Jun 8, 2024https://github.com/python/mypy/pull/17344#issuecomment-2156001365
mypy_primerhttps://github.com/hauntsaninja/mypy_primer
Please reload this pagehttps://github.com/python/mypy/pull/17344
https://github.com/Jordandev678
Jordandev678https://github.com/Jordandev678
Jun 8, 2024https://github.com/python/mypy/pull/17344#issuecomment-2156135468
Please reload this pagehttps://github.com/python/mypy/pull/17344
Please reload this pagehttps://github.com/python/mypy/pull/17344
https://github.com/Jordandev678
Jordandev678https://github.com/Jordandev678
Jun 9, 2024https://github.com/python/mypy/pull/17344#issuecomment-2156590800
https://github.com/mongodb/mongo-python-driverhttps://github.com/mongodb/mongo-python-driver
https://github.com/Rapptz/discord.pyhttps://github.com/Rapptz/discord.py
Please reload this pagehttps://github.com/python/mypy/pull/17344
https://github.com/Jordandev678
Jordandev678https://github.com/Jordandev678
June 9, 2024 13:06https://github.com/python/mypy/pull/17344#event-13091395565
https://github.com/jakkdl
jakkdlhttps://github.com/jakkdl
Jun 20, 2024https://github.com/python/mypy/pull/17344#issuecomment-2181529547
Please reload this pagehttps://github.com/python/mypy/pull/17344
https://github.com/Jordandev678
Jordandev678https://github.com/Jordandev678
Jun 20, 2024https://github.com/python/mypy/pull/17344#issuecomment-2181556919
Please reload this pagehttps://github.com/python/mypy/pull/17344
https://github.com/jakkdl
jakkdlhttps://github.com/jakkdl
Jun 20, 2024https://github.com/python/mypy/pull/17344#issuecomment-2181571708
@ilevkivskyihttps://github.com/ilevkivskyi
@JukkaLhttps://github.com/JukkaL
Please reload this pagehttps://github.com/python/mypy/pull/17344
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
upnext https://github.com/python/mypy/issues?q=state%3Aopen%20label%3Aupnext
Jun 21, 2024https://github.com/python/mypy/pull/17344#event-13238645030
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
Jul 24, 2024 https://github.com/python/mypy/pull/17344#pullrequestreview-2195720337
View reviewed changes https://github.com/python/mypy/pull/17344/files/0bb56898805e16a7e00cc483eefa5250f289ef5d
hauntsaninjahttps://github.com/hauntsaninja
https://github.com/python/mypy/pull/17344#pullrequestreview-2195720337
Learn morehttps://docs.github.com/articles/managing-disruptive-comments/#hiding-a-comment
Please reload this pagehttps://github.com/python/mypy/pull/17344
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
ed0cd4ahttps://github.com/python/mypy/commit/ed0cd4acba02ed19b1cf18ac0ac416dc251d7714
Jul 24, 2024https://github.com/python/mypy/pull/17344#event-13625217932
https://github.com/cdce8p
cdce8phttps://github.com/cdce8p
Jul 25, 2024 https://github.com/python/mypy/pull/17344#ref-pullrequest-2430830420
Update mypy-dev to 1.12.0a2 home-assistant/core#122613 https://github.com/home-assistant/core/pull/122613
https://github.com/JukkaL
JukkaLhttps://github.com/JukkaL
Oct 2, 2024 https://github.com/python/mypy/pull/17344#ref-issue-2561804300
Narrowing inconsistency between == and "in" #17864 https://github.com/python/mypy/issues/17864
JukkaLhttps://github.com/JukkaL
Oct 2, 2024 https://github.com/python/mypy/pull/17344#ref-commit-4aade6a
https://github.com/JukkaL
Revert "Narrow based on collection containment (https://github.com/python/mypy/commit/4aade6a582d17945fb2895a4a5fbb8b045f180b5
#17344https://github.com/python/mypy/pull/17344
)"https://github.com/python/mypy/commit/4aade6a582d17945fb2895a4a5fbb8b045f180b5
4aade6ahttps://github.com/python/mypy/commit/4aade6a582d17945fb2895a4a5fbb8b045f180b5
ed0cd4ahttps://github.com/python/mypy/commit/ed0cd4acba02ed19b1cf18ac0ac416dc251d7714
#17864https://github.com/python/mypy/issues/17864
JukkaLhttps://github.com/JukkaL
Oct 2, 2024 https://github.com/python/mypy/pull/17344#ref-commit-329e38e
https://github.com/JukkaL
Revert "Narrow based on collection containment (https://github.com/python/mypy/commit/329e38e6f23c92d6be7c7839d3b44bf7e2b517dc
#17344https://github.com/python/mypy/pull/17344
)" (https://github.com/python/mypy/commit/329e38e6f23c92d6be7c7839d3b44bf7e2b517dc
#17865https://github.com/python/mypy/pull/17865
)https://github.com/python/mypy/commit/329e38e6f23c92d6be7c7839d3b44bf7e2b517dc
329e38ehttps://github.com/python/mypy/commit/329e38e6f23c92d6be7c7839d3b44bf7e2b517dc
ed0cd4ahttps://github.com/python/mypy/commit/ed0cd4acba02ed19b1cf18ac0ac416dc251d7714
#17864https://github.com/python/mypy/issues/17864
#17864https://github.com/python/mypy/issues/17864
#17841https://github.com/python/mypy/issues/17841
Jordandev678https://github.com/Jordandev678
Oct 9, 2024 https://github.com/python/mypy/pull/17344#ref-commit-7ddf821
https://github.com/Jordandev678
Reapply "Narrow based on collection containment (https://github.com/Jordandev678/mypy/commit/7ddf82190d2744a7d023fcb252b4c62be4a1531c
python#17344https://github.com/python/mypy/pull/17344
)" (https://github.com/Jordandev678/mypy/commit/7ddf82190d2744a7d023fcb252b4c62be4a1531c
pyth…https://github.com/python/mypy/pull/17865
7ddf821https://github.com/Jordandev678/mypy/commit/7ddf82190d2744a7d023fcb252b4c62be4a1531c
…on#17865https://github.com/python/mypy/pull/17865
329e38ehttps://github.com/Jordandev678/mypy/commit/329e38e6f23c92d6be7c7839d3b44bf7e2b517dc
https://github.com/tyralla
tyrallahttps://github.com/tyralla
Oct 26, 2024 https://github.com/python/mypy/pull/17344#ref-pullrequest-2190770248
Support narrowing literals and enums using the in operator in combination with list, set, and tuple expressions. #17044 https://github.com/python/mypy/pull/17044
https://github.com/hauntsaninja
hauntsaninjahttps://github.com/hauntsaninja
Jan 16, 2026 https://github.com/python/mypy/pull/17344#ref-pullrequest-3823772196
Narrow types based on collection containment #20602 https://github.com/python/mypy/pull/20602
https://github.co/hiddenchars
https://github.com/python/mypy/pull/{{ revealButtonHref }}
Sign up for freehttps://github.com/join?source=comment-repo
Sign in to commenthttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Fmypy%2Fpull%2F17344
https://github.com/hauntsaninja
hauntsaninja https://github.com/hauntsaninja
https://github.com/python/mypy/pull/17344/files/0bb56898805e16a7e00cc483eefa5250f289ef5d
upnext https://github.com/python/mypy/issues?q=state%3Aopen%20label%3Aupnext
Type not narrowed correctly for if X in collection https://github.com/python/mypy/issues/3229
Please reload this pagehttps://github.com/python/mypy/pull/17344
https://github.com/Jordandev678
https://github.com/jakkdl
https://github.com/hauntsaninja
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.