René's URL Explorer Experiment


Title: ParamSpec: Allow only `P.args` · Issue #1000 · python/typing · GitHub

Open Graph Title: ParamSpec: Allow only `P.args` · Issue #1000 · python/typing

X Title: ParamSpec: Allow only `P.args` · Issue #1000 · python/typing

Description: I would like to use ParamSpec to type a function that accepts a Callable[P, Any] and *args which will be passed to the callable. The function itself does not accept keyword arguments. As an example, AbstractEventLoop.call_soon behaves si...

Open Graph Description: I would like to use ParamSpec to type a function that accepts a Callable[P, Any] and *args which will be passed to the callable. The function itself does not accept keyword arguments. As an example...

X Description: I would like to use ParamSpec to type a function that accepts a Callable[P, Any] and *args which will be passed to the callable. The function itself does not accept keyword arguments. As an example...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"ParamSpec: Allow only `P.args`","articleBody":"I would like to use `ParamSpec` to type a function that accepts a `Callable[P, Any]` and `*args` which will be passed to the callable. The function itself does not accept keyword arguments. As an example, `AbstractEventLoop.call_soon` behaves similar. This is the current Typeshed definition\r\n```py\r\n    def call_soon(self, callback: Callable[..., Any], *args: Any) -> Handle: ...\r\n```\r\n[typeshed -> stdlib/asyncio/events.pyi -> AbstractEventLoop](https://github.com/python/typeshed/blob/03861b5a1d317b14f516771f296e0325a13ed314/stdlib/asyncio/events.pyi#L90-L95)\r\n\r\n```py\r\nP = ParamSpec(\"P\")\r\n\r\n    def call_soon(self, callback: Callable[P, Any], *args: P.args) -> Handle: ...\r\n```\r\nIntuitively adding a ParamSpec variable like this would make sense: \"Only except `*args`. If any arguments are passed, they need to match those of the `callback`.\" I would also expect that if `callback` has required arguments, they need to be passed with `*args` to `call_soon`.\r\n\r\nThe issue here is that PEP 612 explicitly forbids specifying `P.args` or `P.kwargs` alone. They always need to be together.\r\nhttps://www.python.org/dev/peps/pep-0612/#id2\r\n\r\n```\r\nFurthermore, because the default kind of parameter in Python ((x: int)) may be addressed\r\nboth positionally and through its name, two valid invocations of a (*args: P.args, **kwargs: P.kwargs)\r\nfunction may give different partitions of the same set of parameters. Therefore, we need to make\r\nsure that these special types are only brought into the world together, and are used together,\r\nso that our usage is valid for all possible partitions.\r\n```\r\n\r\nI do wonder if this strict limitation makes sense or if there are other ways to work around it so the case described above could be supported. After all it's similar to adding `**kwargs` to the function signature without ever passing keyword arguments.\r\n```py\r\n    def call_soon(self, callback: Callable[P, Any], *args: P.args, **kwargs: P.kwargs) -> Handle: ...\r\n```","author":{"url":"https://github.com/cdce8p","@type":"Person","name":"cdce8p"},"datePublished":"2022-01-02T15:43:17Z","url":"https://github.com/python/typing/issues/1000"}

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:8b2ae65c-3871-4861-bfaf-f6d3040e88f9
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idD962:30CC09:1C65B8D:261C1A2:6B00016C
html-safe-noncec624441f14580fdebd2426fec147c0c3c335e6ae07531c772626fc5f200afb27
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEOTYyOjMwQ0MwOToxQzY1QjhEOjI2MUMxQTI6NkIwMDAxNkMiLCJ2aXNpdG9yX2lkIjoiNjExOTA4MjIwMDk0OTMyNjE4OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacd94ac05a53427ef5004b8b0eea1f437688f48f48e144914089ddb15bdb6c9a67
hovercard-subject-tagissue:1092045330
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/1000/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5e1f335f55b71f330c27d7dd1e8ba1ff9e632aed3ceae3c02eb7d2c09bd8d116/python/typing/issues/1000
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5e1f335f55b71f330c27d7dd1e8ba1ff9e632aed3ceae3c02eb7d2c09bd8d116/python/typing/issues/1000
og:image:altI would like to use ParamSpec to type a function that accepts a Callable[P, Any] and *args which will be passed to the callable. The function itself does not accept keyword arguments. As an example...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamecdce8p
hostnamegithub.com
expected-hostnamegithub.com
None0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729
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
release16a11879678aaf97e2a42c33ee70830aa084fa37
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/python/typing/issues/1000#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftyping%2Fissues%2F1000
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%2F1000
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/1000
Reloadhttps://github.com/python/typing/issues/1000
Reloadhttps://github.com/python/typing/issues/1000
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/1000
New issuehttps://github.com/login?return_to=https://github.com/python/typing/issues/1000
ParamSpec: Allow only P.argshttps://github.com/python/typing/issues/1000#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/cdce8p
cdce8phttps://github.com/cdce8p
on Jan 2, 2022https://github.com/python/typing/issues/1000#issue-1092045330
typeshed -> stdlib/asyncio/events.pyi -> AbstractEventLoophttps://github.com/python/typeshed/blob/03861b5a1d317b14f516771f296e0325a13ed314/stdlib/asyncio/events.pyi#L90-L95
https://www.python.org/dev/peps/pep-0612/#id2https://www.python.org/dev/peps/pep-0612/#id2
cdce8phttps://github.com/cdce8p
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 Jan 2, 2022https://github.com/python/typing/issues/1000#event-5832782207
https://github.com/TeamSpen210
TeamSpen210https://github.com/TeamSpen210
on Jan 2, 2022https://github.com/python/typing/issues/1000#issuecomment-1003776565
https://github.com/JelleZijlstra
JelleZijlstrahttps://github.com/JelleZijlstra
on Jan 3, 2022https://github.com/python/typing/issues/1000#issuecomment-1003906791
https://www.python.org/dev/peps/pep-0646/#type-variable-tuples-with-callablehttps://www.python.org/dev/peps/pep-0646/#type-variable-tuples-with-callable
https://github.com/erictraut
erictrauthttps://github.com/erictraut
on Jan 4, 2022https://github.com/python/typing/issues/1000#issuecomment-1004459692
@JelleZijlstrahttps://github.com/JelleZijlstra
https://github.com/cdce8p
cdce8phttps://github.com/cdce8p
on Jan 8, 2022https://github.com/python/typing/issues/1000#issuecomment-1008145493
https://github.com/srittau
srittauhttps://github.com/srittau
on Jan 10, 2022https://github.com/python/typing/issues/1000#issuecomment-1008830313
Ariadne middlewarehttps://ariadnegraphql.org/docs/middleware
https://github.com/JelleZijlstra
JelleZijlstrahttps://github.com/JelleZijlstra
on Nov 29, 2023https://github.com/python/typing/issues/1000#issuecomment-1831150930
@cdce8phttps://github.com/cdce8p
JelleZijlstrahttps://github.com/JelleZijlstra
completedhttps://github.com/python/typing/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Nov 29, 2023https://github.com/python/typing/issues/1000#event-11091109241
https://github.com/cdce8p
cdce8phttps://github.com/cdce8p
on Nov 30, 2023https://github.com/python/typing/issues/1000#issuecomment-1833805372
@cdce8phttps://github.com/cdce8p
@erictrauthttps://github.com/erictraut
microsoft/pyright#3775https://github.com/microsoft/pyright/issues/3775
@AlexWaygoodhttps://github.com/AlexWaygood
python/typeshed#8708 (comment)https://github.com/python/typeshed/issues/8708#issuecomment-1241844607
mypy playgroundhttps://mypy-play.net/?mypy=latest&python=3.11&gist=671be72b5b82e1dbab4959e407a027f2
pyright playgroundhttps://pyright-play.net/?code=GYJw9gtgBALgngBwJYDsDmUkQWEMoDCAhgDYlEBGJApgDRQAqi1AakSAwK4I0BQvDAM5QAvI2ZsO3GgAoARELkBKfgBNqwKMBlEAXJhQwlUALQA%2BKADkwKavoB0j3us1od%2B1DHoV9gmCFEoOWVTC2tbBydnDSgAY1ISAH1BMBsZYE4UWP1iMkoaAG0CgCohAF16cOoKqGL2NEF9UsFjcysbO14obqgQahhOEBQtTNiZOpAGlX54smTUlHT6AEYVWaSUtLQV4ygAYigEOBAkNAALfGoQcBBedfmtlfo5AAlqMjBlIA
pyre playgroundhttps://pyre-check.org/play?input=from%20typing%20import%20Callable%0Afrom%20typing_extensions%20import%20TypeVarTuple%2C%20Unpack%0A%0ATs%20%3D%20TypeVarTuple(%22Ts%22)%0A%0Adef%20f(a%3A%20int)%20-%3E%20None%3A%20...%0Adef%20g(a%3A%20int%2C%20b%3A%20str%20%3D%20%22%22)%20-%3E%20None%3A%20...%0A%0Adef%20call_soon(func%3A%20Callable%5B%5BUnpack%5BTs%5D%5D%2C%20None%5D%2C%20*args%3A%20Unpack%5BTs%5D)%20-%3E%20None%3A%0A%20%20%20%20return%20func(*args)%0A%0A%0Acall_soon(f%2C%201)%0Acall_soon(g%2C%201)%20%20%23%20pyright%20error%0Acall_soon(g%2C%201%2C%20%22Hello%22)
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
on Nov 30, 2023https://github.com/python/typing/issues/1000#issuecomment-1833820839
@erictrauthttps://github.com/erictraut
microsoft/pyright#3775https://github.com/microsoft/pyright/issues/3775
@AlexWaygoodhttps://github.com/AlexWaygood
python/typeshed#8708 (comment)https://github.com/python/typeshed/issues/8708#issuecomment-1241844607
python/typeshed#11015https://github.com/python/typeshed/pull/11015
JelleZijlstrahttps://github.com/JelleZijlstra
on Nov 30, 2023https://github.com/python/typing/issues/1000#event-11110776624
https://github.com/erictraut
erictrauthttps://github.com/erictraut
on Dec 1, 2023https://github.com/python/typing/issues/1000#issuecomment-1835490240
@JelleZijlstrahttps://github.com/JelleZijlstra
https://github.com/JelleZijlstra
JelleZijlstrahttps://github.com/JelleZijlstra
on Dec 1, 2023https://github.com/python/typing/issues/1000#issuecomment-1835491230
https://github.com/erictraut
erictrauthttps://github.com/erictraut
on Dec 2, 2023https://github.com/python/typing/issues/1000#issuecomment-1837055262
make this work in pyrighthttps://github.com/microsoft/pyright/issues/6613
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
on Dec 2, 2023https://github.com/python/typing/issues/1000#issuecomment-1837120491
https://github.com/cdce8p
cdce8phttps://github.com/cdce8p
on Dec 6, 2023https://github.com/python/typing/issues/1000#issuecomment-1842661746
https://github.com/microsoft/pyright/releases/tag/1.1.339https://github.com/microsoft/pyright/releases/tag/1.1.339
@srittauhttps://github.com/srittau
earlierhttps://github.com/python/typing/issues/1000#issuecomment-1008830313
https://github.com/srittau
srittauhttps://github.com/srittau
on Dec 6, 2023https://github.com/python/typing/issues/1000#issuecomment-1842684407
#1524https://github.com/python/typing/issues/1524
cdce8phttps://github.com/cdce8p
completedhttps://github.com/python/typing/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Dec 9, 2023https://github.com/python/typing/issues/1000#event-11200564799
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/typing/issues/1000
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/typing/issues/1000
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.