Title: Add PathLike to typing · Issue #402 · python/typing · GitHub
Open Graph Title: Add PathLike to typing · Issue #402 · python/typing
X Title: Add PathLike to typing · Issue #402 · python/typing
Description: While thinking about protocols, it came to my mind that we could add PathLike to typing, also we could make it a (runtime) protocol class. As I understand PEP 519, it could be typed like this: S = TypeVar('S', bound=Union[str, bytes]) cl...
Open Graph Description: While thinking about protocols, it came to my mind that we could add PathLike to typing, also we could make it a (runtime) protocol class. As I understand PEP 519, it could be typed like this: S = ...
X Description: While thinking about protocols, it came to my mind that we could add PathLike to typing, also we could make it a (runtime) protocol class. As I understand PEP 519, it could be typed like this: S = ...
Opengraph URL: https://github.com/python/typing/issues/402
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add PathLike to typing","articleBody":"While thinking about protocols, it came to my mind that we could add ``PathLike`` to typing, also we could make it a (runtime) protocol class. As I understand PEP 519, it could be typed like this:\r\n```python\r\nS = TypeVar('S', bound=Union[str, bytes])\r\nclass PathLike(Generic[S], extra=os.PathLike): # or Protocol[S] in future\r\n def __fspath__(self) -> S:\r\n ...\r\n```\r\nSo that there will be three allowed types: ``PathLike[str]``, ``PathLike[bytes]``, and ``PathLike[Union[str, bytes]]``. Or we actually don't need ``PathLike[Union[str, bytes]]``? In this case we could just use ``AnyStr`` instead of ``S``.\r\n\r\nCC @brettcannon ","author":{"url":"https://github.com/ilevkivskyi","@type":"Person","name":"ilevkivskyi"},"datePublished":"2017-03-21T00:18:45Z","url":"https://github.com/python/typing/issues/402"}
| 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:e4188a2c-e0e0-480b-4187-88763b5734b9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 875E:30263F:215BB67:2D5EE9C:6B002472 |
| html-safe-nonce | d68372cb8ccf7de6981b01536538b05340bdc5a3ee89b41a7dafbda588690395 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4NzVFOjMwMjYzRjoyMTVCQjY3OjJENUVFOUM6NkIwMDI0NzIiLCJ2aXNpdG9yX2lkIjoiNTE1Mjg0MzA0NzU5MDk2MjI5MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3f34e13892b03ab7e079d3d1ee5ea290a99f6c83aa299529cd8ffbcb70cda04c |
| hovercard-subject-tag | issue:215593779 |
| 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/typing/402/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a15c850a59ab1d4f4f07e9377c8c5bd32c4dd845551ac9c2202e070f42ecb517/python/typing/issues/402 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a15c850a59ab1d4f4f07e9377c8c5bd32c4dd845551ac9c2202e070f42ecb517/python/typing/issues/402 |
| og:image:alt | While thinking about protocols, it came to my mind that we could add PathLike to typing, also we could make it a (runtime) protocol class. As I understand PEP 519, it could be typed like this: S = ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | ilevkivskyi |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/typing git https://github.com/python/typing.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 24604008 |
| octolytics-dimension-repository_nwo | python/typing |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24604008 |
| octolytics-dimension-repository_network_root_nwo | python/typing |
| 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