Title: Add typing.Reader and typing.Writer · Issue #564 · python/typing · GitHub
Open Graph Title: Add typing.Reader and typing.Writer · Issue #564 · python/typing
X Title: Add typing.Reader and typing.Writer · Issue #564 · python/typing
Description: I recently stumbled at a TODO in typeshed that proposes to split IO[AnyStr] into smaller pieces. I think it is a good idea and propose to add two protocols: class Reader(Protocol[AnyStr]): def read(self, n: int = ...) -> AnyStr: ... def ...
Open Graph Description: I recently stumbled at a TODO in typeshed that proposes to split IO[AnyStr] into smaller pieces. I think it is a good idea and propose to add two protocols: class Reader(Protocol[AnyStr]): def read...
X Description: I recently stumbled at a TODO in typeshed that proposes to split IO[AnyStr] into smaller pieces. I think it is a good idea and propose to add two protocols: class Reader(Protocol[AnyStr]): def read...
Opengraph URL: https://github.com/python/typing/issues/564
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add typing.Reader and typing.Writer","articleBody":"I recently stumbled at a TODO in typeshed that proposes to split `IO[AnyStr]` into smaller pieces. I think it is a good idea and propose to add two protocols:\r\n```python\r\nclass Reader(Protocol[AnyStr]):\r\n def read(self, n: int = ...) -> AnyStr: ...\r\n def readlines(self) -> List[AnyStr]: ...\r\n def close(self) -> None: ...\r\n\r\nclass Writer(Protocol[AnyStr]):\r\n def write(self, s: AnyStr) -> int: ...\r\n def writelines(self, lines: List[AnyStr]) -> None: ...\r\n def close(self) -> None: ...\r\n```\r\nThen `IO[AnyStr]` can subclass both, plus add some less often used methods (also `IO` should stay nominal). What do you think?","author":{"url":"https://github.com/ilevkivskyi","@type":"Person","name":"ilevkivskyi"},"datePublished":"2018-06-16T23:54:28Z","url":"https://github.com/python/typing/issues/564"}
| 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:52830214-cb99-f31e-dbd0-f5fb837b1305 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9052:23FDF9:1F88DA2:2AF07BE:6B001F83 |
| html-safe-nonce | 8e3ef5b2025e72bf2d686051550de476651d7df33ab22a3d316d6773b7cf81de |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MDUyOjIzRkRGOToxRjg4REEyOjJBRjA3QkU6NkIwMDFGODMiLCJ2aXNpdG9yX2lkIjoiMjc2MDY1Mzk5NDM4MzY0NjU5NiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | f2d6a66f90f2fe1b4d00176f2e0855076ffcd0c7250152cd3d40f1afd5c1b987 |
| hovercard-subject-tag | issue:333023419 |
| 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/564/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0b6a8876201477d8656d7b5558d551d2f9ab72f18632b7c6082df574b5700a15/python/typing/issues/564 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0b6a8876201477d8656d7b5558d551d2f9ab72f18632b7c6082df574b5700a15/python/typing/issues/564 |
| og:image:alt | I recently stumbled at a TODO in typeshed that proposes to split IO[AnyStr] into smaller pieces. I think it is a good idea and propose to add two protocols: class Reader(Protocol[AnyStr]): def read... |
| 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