René's URL Explorer Experiment


Title: regex group class should return `AnyStr | None` instead of `AnyStr | Any` · Issue #10526 · python/typeshed · GitHub

Open Graph Title: regex group class should return `AnyStr | None` instead of `AnyStr | Any` · Issue #10526 · python/typeshed

X Title: regex group class should return `AnyStr | None` instead of `AnyStr | Any` · Issue #10526 · python/typeshed

Description: Every time when using the regex library I'm stumbling over this when extracting the group text from a regex match. From what I read the function returns the match as an AnyStr which corresponds to the type variable of the Match[AnyStr]. ...

Open Graph Description: Every time when using the regex library I'm stumbling over this when extracting the group text from a regex match. From what I read the function returns the match as an AnyStr which corresponds to ...

X Description: Every time when using the regex library I'm stumbling over this when extracting the group text from a regex match. From what I read the function returns the match as an AnyStr which corresponds...

Opengraph URL: https://github.com/python/typeshed/issues/10526

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"regex group class should return `AnyStr | None` instead of `AnyStr | Any`","articleBody":"Every time when using the regex library I'm stumbling over this when extracting the group text from a regex match. From what I read the function returns the match as an AnyStr which corresponds to the type variable of the `Match[AnyStr]`. But it also returns Any. I don't possibly know how to return anything else from this method.\r\n\r\nIf a match was successful the group method will do one of the following:\r\n1. The last text matched by the capturing group (either by name or number) as an AnyStr type `(?P\u003cgroupname>.+)`\r\n2. `None` if the capturing group was part of a regex branch that did not match `(\\d+)|(\\w+)`\r\n3. The Error `IndexError(\"no such group\")` if a group was referred that is not part of the pattern.\r\n\r\n[This](https://github.com/python/typeshed/blob/d62cbb98f4ecc2d46bcacfe49cea97bc4efb0ed6/stdlib/re.pyi#L77C58-L77C58) is the method and [here](https://github.com/python/typeshed/blob/d62cbb98f4ecc2d46bcacfe49cea97bc4efb0ed6/stdlib/re.pyi#L73C1-L73C1) is the comment that argues similar.\r\n\r\nThe same problem can be observed in the following places:\r\n- [group(self, __group)](https://github.com/python/typeshed/blob/d62cbb98f4ecc2d46bcacfe49cea97bc4efb0ed6/stdlib/re.pyi#L77)\r\n- [group(self, __group1, __group2, *groups)](https://github.com/python/typeshed/blob/d62cbb98f4ecc2d46bcacfe49cea97bc4efb0ed6/stdlib/re.pyi#L79)\r\n- [groups(self)](https://github.com/python/typeshed/blob/d62cbb98f4ecc2d46bcacfe49cea97bc4efb0ed6/stdlib/re.pyi#L83C44-L83C44)\r\n- [groupdict(self)](https://github.com/python/typeshed/blob/d62cbb98f4ecc2d46bcacfe49cea97bc4efb0ed6/stdlib/re.pyi#L89)\r\n- [\\_\\_getitem__(self)](https://github.com/python/typeshed/blob/d62cbb98f4ecc2d46bcacfe49cea97bc4efb0ed6/stdlib/re.pyi#L101)\r\n\r\nNote: I'm not a professional and I don't even know if this is the right repository for this issue, but I didn't find any better guidance on where to post this.\r\n\r\nThe advantages of the `AnyStr | None` annotation would be:\r\n- null coalescion: `text: str = match.group(1) or \"default\"`\r\n- branching: `if match.group(1): print(\"Match group 1 has matched something\")`","author":{"url":"https://github.com/cn-ml","@type":"Person","name":"cn-ml"},"datePublished":"2023-08-01T13:54:44Z","url":"https://github.com/python/typeshed/issues/10526"}

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:a4797a16-6602-6a91-b948-cb3bc4dcf8a1
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE8D6:3E4AC7:28B58F2:374EBEA:6B004501
html-safe-nonced19b409bfadfce6fb5bee3b8419a4f1d63cc0c3e31cde642675765c6196899f1
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOEQ2OjNFNEFDNzoyOEI1OEYyOjM3NEVCRUE6NkIwMDQ1MDEiLCJ2aXNpdG9yX2lkIjoiNDA4MTAyODI2ODA0MjUwMzQyNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac692393935d605b18237147ff321de3403de26053ec83a88051de296900fc2fda
hovercard-subject-tagissue:1831346905
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/typeshed/10526/issue_layout
twitter:imagehttps://opengraph.githubassets.com/016ebbe5b07b2511cef06a2aa848ba2aa69233eb5c578c8493bb4eb1d4a5eb23/python/typeshed/issues/10526
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/016ebbe5b07b2511cef06a2aa848ba2aa69233eb5c578c8493bb4eb1d4a5eb23/python/typeshed/issues/10526
og:image:altEvery time when using the regex library I'm stumbling over this when extracting the group text from a regex match. From what I read the function returns the match as an AnyStr which corresponds to ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamecn-ml
hostnamegithub.com
expected-hostnamegithub.com
None7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0
turbo-cache-controlno-preview
go-importgithub.com/python/typeshed git https://github.com/python/typeshed.git
octolytics-dimension-user_id1525981
octolytics-dimension-user_loginpython
octolytics-dimension-repository_id31696383
octolytics-dimension-repository_nwopython/typeshed
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id31696383
octolytics-dimension-repository_network_root_nwopython/typeshed
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/typeshed/issues/10526#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fpython%2Ftypeshed%2Fissues%2F10526
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%2Ftypeshed%2Fissues%2F10526
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%2Ftypeshed
Reloadhttps://github.com/python/typeshed/issues/10526
Reloadhttps://github.com/python/typeshed/issues/10526
Reloadhttps://github.com/python/typeshed/issues/10526
pythonhttps://github.com/python
typeshedhttps://github.com/python/typeshed
Codehttps://github.com/python/typeshed
Issues196 (196)https://github.com/python/typeshed/issues
Pull requests252 (252)https://github.com/python/typeshed/pulls
Actionshttps://github.com/python/typeshed/actions
Security and qualityhttps://github.com/python/typeshed/security
Insightshttps://github.com/python/typeshed/insights
https://github.com/python/typeshed
New issuehttps://github.com/login?return_to=https://github.com/python/typeshed/issues/10526
New issuehttps://github.com/login?return_to=https://github.com/python/typeshed/issues/10526
regex group class should return AnyStr | None instead of AnyStr | Anyhttps://github.com/python/typeshed/issues/10526#top
https://github.com/cn-ml
cn-mlhttps://github.com/cn-ml
on Aug 1, 2023https://github.com/python/typeshed/issues/10526#issue-1831346905
Thishttps://github.com/python/typeshed/blob/d62cbb98f4ecc2d46bcacfe49cea97bc4efb0ed6/stdlib/re.pyi#L77C58-L77C58
herehttps://github.com/python/typeshed/blob/d62cbb98f4ecc2d46bcacfe49cea97bc4efb0ed6/stdlib/re.pyi#L73C1-L73C1
group(self, __group)https://github.com/python/typeshed/blob/d62cbb98f4ecc2d46bcacfe49cea97bc4efb0ed6/stdlib/re.pyi#L77
group(self, __group1, __group2, *groups)https://github.com/python/typeshed/blob/d62cbb98f4ecc2d46bcacfe49cea97bc4efb0ed6/stdlib/re.pyi#L79
groups(self)https://github.com/python/typeshed/blob/d62cbb98f4ecc2d46bcacfe49cea97bc4efb0ed6/stdlib/re.pyi#L83C44-L83C44
groupdict(self)https://github.com/python/typeshed/blob/d62cbb98f4ecc2d46bcacfe49cea97bc4efb0ed6/stdlib/re.pyi#L89
__getitem__(self)https://github.com/python/typeshed/blob/d62cbb98f4ecc2d46bcacfe49cea97bc4efb0ed6/stdlib/re.pyi#L101
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
on Aug 1, 2023https://github.com/python/typeshed/issues/10526#issuecomment-1660390719
https://github.com/AlexWaygood
AlexWaygoodhttps://github.com/AlexWaygood
on Aug 1, 2023https://github.com/python/typeshed/issues/10526#issuecomment-1660395777
#9465https://github.com/python/typeshed/issues/9465
#9482https://github.com/python/typeshed/pull/9482
hauntsaninjahttps://github.com/hauntsaninja
not plannedhttps://github.com/python/typeshed/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Anot-planned
on Aug 1, 2023https://github.com/python/typeshed/issues/10526#event-9980016439
https://github.com/cn-ml
cn-mlhttps://github.com/cn-ml
on Aug 3, 2023https://github.com/python/typeshed/issues/10526#issuecomment-1663627971
https://github.com/cn-ml
cn-mlhttps://github.com/cn-ml
on Aug 3, 2023https://github.com/python/typeshed/issues/10526#issuecomment-1663652523
#9465https://github.com/python/typeshed/issues/9465
#9482https://github.com/python/typeshed/pull/9482
https://github.com/KotlinIsland
KotlinIslandhttps://github.com/KotlinIsland
on Jan 18, 2024https://github.com/python/typeshed/issues/10526#issuecomment-1897574662
Sign up for freehttps://github.com/signup?return_to=https://github.com/python/typeshed/issues/10526
Sign in to commenthttps://github.com/login?return_to=https://github.com/python/typeshed/issues/10526
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.