René's URL Explorer Experiment


Title: Check that literal strings/int/float belong to /is excluded from a set/range of values · Issue #478 · python/typing · GitHub

Open Graph Title: Check that literal strings/int/float belong to /is excluded from a set/range of values · Issue #478 · python/typing

X Title: Check that literal strings/int/float belong to /is excluded from a set/range of values · Issue #478 · python/typing

Description: Opened in python/mypy#4040, but moved here after @JukkaL 's advice. Some debate took place in there, but I'll copy the original post here for context: It's a common practice to pass literal strings as arguments. In Python, it's even more...

Open Graph Description: Opened in python/mypy#4040, but moved here after @JukkaL 's advice. Some debate took place in there, but I'll copy the original post here for context: It's a common practice to pass literal strings...

X Description: Opened in python/mypy#4040, but moved here after @JukkaL 's advice. Some debate took place in there, but I'll copy the original post here for context: It's a common practice to pass lit...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Check that literal strings/int/float belong to /is excluded from a set/range of values","articleBody":"Opened in https://github.com/python/mypy/issues/4040, but moved here after @JukkaL 's advice.\r\n\r\nSome debate took place in there, but I'll copy the original post here for context:\r\n\r\n---\r\n\r\nIt's a common practice to pass literal strings as arguments. In Python, it's even more important, as strings are often used instead of byte flags, constants or enums.\r\n\r\nYou often end up checking if those literals are passed correctly so you can give some debug information: \r\n\r\n- sorry, the parameter mode except a string among \"started, paused, cancelled\";\r\n\r\n- you can only used an integer between 0 and 16.\r\n\r\netc.\r\n\r\nThe problem with that is it's done at runtime despite the fact those argument are completely static ones. So the IDE can't use this information to help you write code. Typically, I would have code completion and linting helping me with \"started/pause/cancelled\" if it was an enum, but not if it's a string.\r\n\r\nWith this concept I could do:\r\n\r\n```\r\nMODES = ('started', 'paused', 'cancelled')\r\nLEVELS = (\r\n    range(0, 5),\r\n    range(40, float('+inf')), \r\n)\r\n\r\ndef foo(mode: typing.Among(MODES), levels: typing.Among(LEVELS)):\r\n    pass\r\n```\r\n\r\nSo that mypy could alert my users if they do:\r\n\r\n`def foo(\"Start\", 6):`\r\n\r\nOf course, it's only for strings/ints/floats literals, maybe bytes and tuple, as we need the information to be immutable and simple to be usable.","author":{"url":"https://github.com/sametmax","@type":"Person","name":"sametmax"},"datePublished":"2017-10-02T11:56:01Z","url":"https://github.com/python/typing/issues/478"}

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:0867c8e6-1719-2839-b0d9-0a6a23cb2a4b
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idB610:22BD05:213DC95:2D050B9:6B00219B
html-safe-nonce4e1561cbc686f4af756800d8d22e129b5ba191d32180611d9e4247ce85e1f590
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNjEwOjIyQkQwNToyMTNEQzk1OjJEMDUwQjk6NkIwMDIxOUIiLCJ2aXNpdG9yX2lkIjoiNTk5MDg0ODE1MjY2NjY0NDg5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac55838fd06cdd60f8bea786acfb65fa4ff79b8c4b2f92c118540fa66538e48cb9
hovercard-subject-tagissue:262061173
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/478/issue_layout
twitter:imagehttps://opengraph.githubassets.com/2a00dd1ef93fcf06e0df53e3b2b53e7518ce38e817034d5d1ae627e4e6e0c948/python/typing/issues/478
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/2a00dd1ef93fcf06e0df53e3b2b53e7518ce38e817034d5d1ae627e4e6e0c948/python/typing/issues/478
og:image:altOpened in python/mypy#4040, but moved here after @JukkaL 's advice. Some debate took place in there, but I'll copy the original post here for context: It's a common practice to pass literal strings...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamesametmax
hostnamegithub.com
expected-hostnamegithub.com
None4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0
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
release44c658b24abf00491fb7ae5f56d42c9f38cbeab2
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/typing/issues/478#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftyping%2Fissues%2F478
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%2F478
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/478
Reloadhttps://github.com/python/typing/issues/478
Reloadhttps://github.com/python/typing/issues/478
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/478
New issuehttps://github.com/login?return_to=https://github.com/python/typing/issues/478
Check that literal strings/int/float belong to /is excluded from a set/range of valueshttps://github.com/python/typing/issues/478#top
https://github.com/sametmax
sametmaxhttps://github.com/sametmax
on Oct 2, 2017https://github.com/python/typing/issues/478#issue-262061173
python/mypy#4040https://github.com/python/mypy/issues/4040
@JukkaLhttps://github.com/JukkaL
Nexthttps://github.com/python/typing/issues/478?timeline_page=1
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Oct 2, 2017https://github.com/python/typing/issues/478#issuecomment-333577333
https://github.com/shoyer
shoyerhttps://github.com/shoyer
on Oct 26, 2017https://github.com/python/typing/issues/478#issuecomment-339817759
pandas.to_datetime()https://pandas.pydata.org/pandas-docs/stable/generated/pandas.to_datetime.html#pandas.to_datetime
https://github.com/JukkaL
JukkaLhttps://github.com/JukkaL
on Oct 27, 2017https://github.com/python/typing/issues/478#issuecomment-339844266
@shoyerhttps://github.com/shoyer
https://github.com/shoyer
shoyerhttps://github.com/shoyer
on Oct 27, 2017https://github.com/python/typing/issues/478#issuecomment-339869456
API docs for pandashttps://pandas.pydata.org/pandas-docs/stable/api.html
pandas-dev/pandas#14468https://github.com/pandas-dev/pandas/issues/14468
very popular libraryhttps://stackoverflow.blog/2017/09/14/python-growing-quickly/
https://github.com/JukkaL
JukkaLhttps://github.com/JukkaL
on Oct 27, 2017https://github.com/python/typing/issues/478#issuecomment-340062632
@shoyerhttps://github.com/shoyer
https://github.com/TeamSpen210
TeamSpen210https://github.com/TeamSpen210
on Oct 29, 2017https://github.com/python/typing/issues/478#issuecomment-340232346
https://github.com/shoyer
shoyerhttps://github.com/shoyer
on Oct 29, 2017https://github.com/python/typing/issues/478#issuecomment-340234886
ufuncshttps://docs.scipy.org/doc/numpy-1.13.0/reference/ufuncs.html
https://github.com/rowillia
rowilliahttps://github.com/rowillia
on Oct 30, 2017https://github.com/python/typing/issues/478#issuecomment-340578947
@JukkaLhttps://github.com/JukkaL
@ambvhttps://github.com/ambv
https://github.com/gvanrossum
gvanrossumhttps://github.com/gvanrossum
on Oct 30, 2017https://github.com/python/typing/issues/478#issuecomment-340580950
https://github.com/emmatyping
emmatypinghttps://github.com/emmatyping
on Oct 30, 2017https://github.com/python/typing/issues/478#issuecomment-340588297
https://github.com/gvanrossum
gvanrossumhttps://github.com/gvanrossum
on Oct 30, 2017https://github.com/python/typing/issues/478#issuecomment-340589079
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Oct 30, 2017https://github.com/python/typing/issues/478#issuecomment-340608701
https://github.com/shoyer
shoyerhttps://github.com/shoyer
on Oct 30, 2017https://github.com/python/typing/issues/478#issuecomment-340610345
@gvanrossumhttps://github.com/gvanrossum
@ilevkivskyihttps://github.com/ilevkivskyi
https://github.com/emmatyping
emmatypinghttps://github.com/emmatyping
on Oct 31, 2017https://github.com/python/typing/issues/478#issuecomment-340627397
@ilevkivskyihttps://github.com/ilevkivskyi
https://github.com/JukkaL
JukkaLhttps://github.com/JukkaL
on Oct 31, 2017https://github.com/python/typing/issues/478#issuecomment-340719046
@ilevkivskyihttps://github.com/ilevkivskyi
https://github.com/junjihashimoto
junjihashimotohttps://github.com/junjihashimoto
on Nov 30, 2017https://github.com/python/typing/issues/478#issuecomment-348274178
https://github.com/iddan
iddanhttps://github.com/iddan
on Jun 21, 2018https://github.com/python/typing/issues/478#issuecomment-399108362
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Jun 21, 2018https://github.com/python/typing/issues/478#issuecomment-399112896
https://github.com/pawelswiecki
pawelswieckihttps://github.com/pawelswiecki
on Aug 10, 2018https://github.com/python/typing/issues/478#issuecomment-412002002
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Aug 10, 2018https://github.com/python/typing/issues/478#issuecomment-412047918
https://github.com/pawelswiecki
pawelswieckihttps://github.com/pawelswiecki
on Aug 10, 2018https://github.com/python/typing/issues/478#issuecomment-412104528
https://github.com/Michael0x2a
Michael0x2ahttps://github.com/Michael0x2a
on Nov 20, 2018https://github.com/python/typing/issues/478#issuecomment-440157712
https://github.com/Michael0x2a/peps/blob/literal-types/pep-9999.rsthttps://github.com/Michael0x2a/peps/blob/literal-types/pep-9999.rst
shiny new typing-sigs mailing listhttps://mail.python.org/mailman3/lists/typing-sig.python.org/
in the mypy docshttps://mypy.readthedocs.io/en/latest/final_attrs.html
https://github.com/dkgi
dkgihttps://github.com/dkgi
on Nov 20, 2018https://github.com/python/typing/issues/478#issuecomment-440295106
@Michael0x2ahttps://github.com/Michael0x2a
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Nov 20, 2018https://github.com/python/typing/issues/478#issuecomment-440307816
@Michael0x2ahttps://github.com/Michael0x2a
https://github.com/JukkaL
JukkaLhttps://github.com/JukkaL
on Nov 20, 2018https://github.com/python/typing/issues/478#issuecomment-440315650
https://github.com/mrkmndz
mrkmndzhttps://github.com/mrkmndz
on Nov 20, 2018https://github.com/python/typing/issues/478#issuecomment-440359090
https://github.com/JukkaL
JukkaLhttps://github.com/JukkaL
on Nov 20, 2018https://github.com/python/typing/issues/478#issuecomment-440372813
@mrkmndzhttps://github.com/mrkmndz
https://github.com/Michael0x2a
Michael0x2ahttps://github.com/Michael0x2a
on Nov 20, 2018https://github.com/python/typing/issues/478#issuecomment-440379421
@dkgihttps://github.com/dkgi
Michael0x2a/peps#1https://github.com/Michael0x2a/peps/pull/1
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Jun 20, 2019https://github.com/python/typing/issues/478#issuecomment-503802779
ilevkivskyihttps://github.com/ilevkivskyi
completedhttps://github.com/python/typing/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Jun 20, 2019https://github.com/python/typing/issues/478#event-2425919025
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/typing/issues/478
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/typing/issues/478
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.