Title: Reason for `re.Match.group` and `re.Match.__getitem__` returning `AnyStr | Any`? · Issue #9465 · python/typeshed · GitHub
Open Graph Title: Reason for `re.Match.group` and `re.Match.__getitem__` returning `AnyStr | Any`? · Issue #9465 · python/typeshed
X Title: Reason for `re.Match.group` and `re.Match.__getitem__` returning `AnyStr | Any`? · Issue #9465 · python/typeshed
Description: Is there a reason why the return annotation is AnyStr | Any instead of AnyStr | None in the snippets below? typeshed/stdlib/re.pyi Lines 72 to 77 in b1cb9c8 @overload def group(self, __group: Literal[0] = ...) -> AnyStr: ... @overload de...
Open Graph Description: Is there a reason why the return annotation is AnyStr | Any instead of AnyStr | None in the snippets below? typeshed/stdlib/re.pyi Lines 72 to 77 in b1cb9c8 @overload def group(self, __group: Liter...
X Description: Is there a reason why the return annotation is AnyStr | Any instead of AnyStr | None in the snippets below? typeshed/stdlib/re.pyi Lines 72 to 77 in b1cb9c8 @overload def group(self, __group: Liter...
Opengraph URL: https://github.com/python/typeshed/issues/9465
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Reason for `re.Match.group` and `re.Match.__getitem__` returning `AnyStr | Any`?","articleBody":"Is there a reason why the return annotation is `AnyStr | Any` instead of `AnyStr | None` in the snippets below?\r\n\r\nhttps://github.com/python/typeshed/blob/b1cb9c8a8fde1552b75dc17d4d9612905f6766d4/stdlib/re.pyi#L72-L77\r\n\r\nhttps://github.com/python/typeshed/blob/b1cb9c8a8fde1552b75dc17d4d9612905f6766d4/stdlib/re.pyi#L96-L99\r\n\r\nIf not, I'd like to submit a PR to change the return type hints accordingly.\r\n\r\nThank you!\r\n","author":{"url":"https://github.com/willfrey","@type":"Person","name":"willfrey"},"datePublished":"2023-01-06T15:37:05Z","url":"https://github.com/python/typeshed/issues/9465"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:77490c3e-1107-13b2-72a1-97ec5aefd089 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CCA2:2A4B31:34FA3A:47CD25:6B00291C |
| html-safe-nonce | 3576e28ed4a454363942ff7be4e54221d2e2b5d98d4322037e42d2717217854d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQ0EyOjJBNEIzMTozNEZBM0E6NDdDRDI1OjZCMDAyOTFDIiwidmlzaXRvcl9pZCI6IjcyNTc0NjUzNTI5MjgzNzMwMjEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 86bf04ff9cccd2c1d0607820af2c25fa55fb201e4f594d5f67785a7966818a75 |
| hovercard-subject-tag | issue:1522768415 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/typeshed/9465/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ae211ad8af5b7f513dce40f90db36bac9096d802708a49e787214491f8b3d594/python/typeshed/issues/9465 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ae211ad8af5b7f513dce40f90db36bac9096d802708a49e787214491f8b3d594/python/typeshed/issues/9465 |
| og:image:alt | Is there a reason why the return annotation is AnyStr | Any instead of AnyStr | None in the snippets below? typeshed/stdlib/re.pyi Lines 72 to 77 in b1cb9c8 @overload def group(self, __group: Liter... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | willfrey |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typeshed git https://github.com/python/typeshed.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 31696383 |
| octolytics-dimension-repository_nwo | python/typeshed |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 31696383 |
| octolytics-dimension-repository_network_root_nwo | python/typeshed |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width