René's URL Explorer Experiment


Title: Support Ellipsis as a type per se · Issue #684 · python/typing · GitHub

Open Graph Title: Support Ellipsis as a type per se · Issue #684 · python/typing

X Title: Support Ellipsis as a type per se · Issue #684 · python/typing

Description: Referenced from python/mypy#7818 We use an Ellipsis as an easy-to-understand, easy-to-import sentinel value to mean "everything else". But it's not possible to use fully with type checking, since mypy doesn't exclude it from a type when ...

Open Graph Description: Referenced from python/mypy#7818 We use an Ellipsis as an easy-to-understand, easy-to-import sentinel value to mean "everything else". But it's not possible to use fully with type checking, since m...

X Description: Referenced from python/mypy#7818 We use an Ellipsis as an easy-to-understand, easy-to-import sentinel value to mean "everything else". But it's not possible to use fully with type che...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Support Ellipsis as a type per se","articleBody":"Referenced from https://github.com/python/mypy/issues/7818\r\n\r\nWe use an Ellipsis as an easy-to-understand, easy-to-import sentinel value to mean \"everything else\". \r\n\r\nBut it's not possible to use fully with type checking, since mypy doesn't exclude it from a type when it's been excluded with an `if`, as it does for `None`, or `Enum`s per https://github.com/python/typing/pull/240). I've moved the issue here since it's apparently a python typing issue rather than a mypy implementation.\r\n\r\nI've included below a MCVE of the behavior below, and here's an example of how we use it, given @gvanrossum has [already asked](https://github.com/python/mypy/issues/2180) whether it's important to use an Ellipsis:\r\n\r\n\r\n\u003cdetails>\r\n\r\nFor example, to transpose an array, these are equivalent:\r\n\r\n```python\r\n\r\nIn [1]: import xarray as xr\r\n\r\nIn [2]: ds = xr.tutorial.scatter_example_dataset()\r\n\r\nIn [3]: ds\r\nOut[3]:\r\n\u003cxarray.Dataset>\r\nDimensions:  (w: 4, x: 3, y: 11, z: 4)\r\nCoordinates:\r\n  * x        (x) int64 0 1 2\r\n  * y        (y) float64 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0\r\n  * z        (z) int64 0 1 2 3\r\n  * w        (w) \u003cU5 'one' 'two' 'three' 'five'\r\nData variables:\r\n    A        (x, y, z, w) float64 0.02074 0.04807 -0.1059 ... -0.1809 -0.04862\r\n    B        (x, y, z, w) float64 0.0 0.0 0.0 0.0 ... 1.406 1.414 1.368 1.408\r\n\r\nIn [4]: ds.transpose('w','x','y','z')\r\nOut[4]:\r\n\u003cxarray.Dataset>\r\nDimensions:  (w: 4, x: 3, y: 11, z: 4)\r\nCoordinates:\r\n  * x        (x) int64 0 1 2\r\n  * y        (y) float64 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0\r\n  * z        (z) int64 0 1 2 3\r\n  * w        (w) \u003cU5 'one' 'two' 'three' 'five'\r\nData variables:\r\n    A        (w, x, y, z) float64 0.02074 0.02074 0.02074 ... -0.03076 -0.04862\r\n    B        (w, x, y, z) float64 0.0 0.002074 0.004147 ... 1.403 1.405 1.408\r\n\r\n\r\nIn [5]: ds.transpose('w',...) # use an Ellipsis to indicate 'all other dimensions'\r\nOut[5]:\r\n\u003cxarray.Dataset>\r\nDimensions:  (w: 4, x: 3, y: 11, z: 4)\r\nCoordinates:\r\n  * x        (x) int64 0 1 2\r\n  * y        (y) float64 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0\r\n  * z        (z) int64 0 1 2 3\r\n  * w        (w) \u003cU5 'one' 'two' 'three' 'five'\r\nData variables:\r\n    A        (w, x, y, z) float64 0.02074 0.02074 0.02074 ... -0.03076 -0.04862\r\n    B        (w, x, y, z) float64 0.0 0.002074 0.004147 ... 1.403 1.405 1.408\r\n```\r\n\r\n\u003c/details>\r\n\r\nCode example with existing mypy:\r\n\r\n```python\r\nimport builtins\r\nfrom typing import List, Union\r\n\r\n\r\ndef fun(x: Union[builtins.ellipsis, List], y: List):\r\n    if x is not Ellipsis:\r\n        y = x #  error: Incompatible types in assignment (expression has type \"Union[ellipsis, List[Any]]\", variable has type \"List[Any]\")\r\n\r\n    return y\r\n\r\n# another attempt:\r\ndef fun2(x: Union[Ellipsis, List], y: List): # error: Variable \"builtins.Ellipsis\" is not valid as a type\r\n    if x is not Ellipsis:\r\n        y = x\r\n\r\n    return y\r\n\r\n```\r\n\r\nThank you!\r\n","author":{"url":"https://github.com/max-sixty","@type":"Person","name":"max-sixty"},"datePublished":"2019-10-30T18:36:21Z","url":"https://github.com/python/typing/issues/684"}

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:6ab6e24f-f8b8-a665-0451-9db4d3c8e800
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCB6C:23E2FF:108E68:169EC5:6B0063B5
html-safe-nonce13704e9a53b9540ff72eabf5e0c914b9a84dc90a63e68ca04128127a4e9aca19
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQjZDOjIzRTJGRjoxMDhFNjg6MTY5RUM1OjZCMDA2M0I1IiwidmlzaXRvcl9pZCI6IjM2ODU2NDE5MzU3NTU5Mjg4NSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac02a45fa03dad8526c2f51ee195e393ecaa2ff3fdd56e561c10e881db9ba36c3a
hovercard-subject-tagissue:514895051
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/684/issue_layout
twitter:imagehttps://opengraph.githubassets.com/d2845e67f86f3445c910c6b9ec92430b4c862f34838779be6c2750ff4430767a/python/typing/issues/684
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/d2845e67f86f3445c910c6b9ec92430b4c862f34838779be6c2750ff4430767a/python/typing/issues/684
og:image:altReferenced from python/mypy#7818 We use an Ellipsis as an easy-to-understand, easy-to-import sentinel value to mean "everything else". But it's not possible to use fully with type checking, since m...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemax-sixty
hostnamegithub.com
expected-hostnamegithub.com
None25854482a1773a7c1ebb8be3d2bc1c6e61d82d78126be63b5044474a86d44d9e
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
releasee4f5c239e31f1f680e6bbc419ff92d774da616ec
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/typing/issues/684#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftyping%2Fissues%2F684
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%2F684
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/684
Reloadhttps://github.com/python/typing/issues/684
Reloadhttps://github.com/python/typing/issues/684
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/684
New issuehttps://github.com/login?return_to=https://github.com/python/typing/issues/684
Support Ellipsis as a type per sehttps://github.com/python/typing/issues/684#top
topic: featureDiscussions about new features for Python's type annotationshttps://github.com/python/typing/issues?q=state%3Aopen%20label%3A%22topic%3A%20feature%22
https://github.com/max-sixty
max-sixtyhttps://github.com/max-sixty
on Oct 30, 2019https://github.com/python/typing/issues/684#issue-514895051
python/mypy#7818https://github.com/python/mypy/issues/7818
#240https://github.com/python/typing/pull/240
@gvanrossumhttps://github.com/gvanrossum
already askedhttps://github.com/python/mypy/issues/2180
https://github.com/gvanrossum
gvanrossumhttps://github.com/gvanrossum
on Oct 30, 2019https://github.com/python/typing/issues/684#issuecomment-548142325
https://github.com/max-sixty
max-sixtyhttps://github.com/max-sixty
on Oct 31, 2019https://github.com/python/typing/issues/684#issuecomment-548165667
https://github.com/gvanrossum
gvanrossumhttps://github.com/gvanrossum
on Oct 31, 2019https://github.com/python/typing/issues/684#issuecomment-548203158
https://github.com/max-sixty
max-sixtyhttps://github.com/max-sixty
on Nov 2, 2019https://github.com/python/typing/issues/684#issuecomment-549067403
@gvanrossumhttps://github.com/gvanrossum
https://github.com/ilevkivskyi
ilevkivskyihttps://github.com/ilevkivskyi
on Nov 4, 2019https://github.com/python/typing/issues/684#issuecomment-549334324
https://bugs.python.orghttps://bugs.python.org
ilevkivskyihttps://github.com/ilevkivskyi
completedhttps://github.com/python/typing/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Nov 4, 2019https://github.com/python/typing/issues/684#event-2767515935
https://github.com/mpkocher
mpkocherhttps://github.com/mpkocher
on Nov 23, 2020https://github.com/python/typing/issues/684#issuecomment-732195422
https://bugs.python.org/issue41810https://bugs.python.org/issue41810
https://github.com/gvanrossum
gvanrossumhttps://github.com/gvanrossum
on Nov 23, 2020https://github.com/python/typing/issues/684#issuecomment-732224052
gvanrossumhttps://github.com/gvanrossum
on Nov 23, 2020https://github.com/python/typing/issues/684#event-4028169908
https://github.com/jp-larose
jp-larosehttps://github.com/jp-larose
on May 7, 2021https://github.com/python/typing/issues/684#issuecomment-834050597
python/mypy#7818https://github.com/python/mypy/issues/7818
srittauhttps://github.com/srittau
topic: featureDiscussions about new features for Python's type annotationshttps://github.com/python/typing/issues?q=state%3Aopen%20label%3A%22topic%3A%20feature%22
on Nov 4, 2021https://github.com/python/typing/issues/684#event-5567916413
https://github.com/max-sixty
max-sixtyhttps://github.com/max-sixty
on Dec 1, 2022https://github.com/python/typing/issues/684#issuecomment-1334527369
https://bugs.python.org/issue41810https://bugs.python.org/issue41810
pydata/xarray#7343https://github.com/pydata/xarray/pull/7343
max-sixtyhttps://github.com/max-sixty
completedhttps://github.com/python/typing/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Dec 1, 2022https://github.com/python/typing/issues/684#event-7936101891
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/typing/issues/684
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/typing/issues/684
topic: featureDiscussions about new features for Python's type annotationshttps://github.com/python/typing/issues?q=state%3Aopen%20label%3A%22topic%3A%20feature%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.