Title: Protocol naming convention · Issue #4174 · python/typeshed · GitHub
Open Graph Title: Protocol naming convention · Issue #4174 · python/typeshed
X Title: Protocol naming convention · Issue #4174 · python/typeshed
Description: Now that we have a central stub for common types and protocols, we should think about how we name protocols in typeshed. Currently there is no common convention. Some possible conventions for a "read" protocol: Readable HasRead SupportsR...
Open Graph Description: Now that we have a central stub for common types and protocols, we should think about how we name protocols in typeshed. Currently there is no common convention. Some possible conventions for a "re...
X Description: Now that we have a central stub for common types and protocols, we should think about how we name protocols in typeshed. Currently there is no common convention. Some possible conventions for a &qu...
Opengraph URL: https://github.com/python/typeshed/issues/4174
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Protocol naming convention","articleBody":"Now that we have a central stub for common types and protocols, we should think about how we name protocols in typeshed. Currently there is no common convention. Some possible conventions for a \"read\" protocol:\r\n\r\n* `Readable`\r\n* `HasRead`\r\n* `SupportsRead`\r\n* `IsReadable`\r\n* `Reader`\r\n\r\nI have no strong preferences, but I think the naming to reflect that a class is a protocol. Therefore I'd suggest we should use either, some, or all of the above. The second name (`HasRead`) clearly implies the existence of a field `read`, but would exclude protocols with multiple fields, such as this from `stdlib/3.9/zoneinfo/__init__.pyi`:\r\n\r\n```python\r\nclass _IOBytes(Protocol):\r\n def read(self, __size: int) -> bytes: ...\r\n def seek(self, __size: int, __whence: int = ...) -> Any: ...\r\n```\r\nHere is a proposal to start the discussion:\r\n\r\n* Use plain names for protocols that represent a clear concept (e.g. `Iterator`, `Container`).\r\n* Use `SupportsX` for protocols that provide type conversion (e.g. `SupportsInt`).\r\n* Use `Xable` for protocols that provide callable methods (e.g. `Readable`, `LineReadable`, `BytesReadable`, `ReadSeekable`).\r\n* Use `HasX` for protocols that have readable and/or writable attributes or getter/setter methods (e.g. `HasItems`, `HasFileno`).\r\n","author":{"url":"https://github.com/srittau","@type":"Person","name":"srittau"},"datePublished":"2020-06-04T12:40:15Z","url":"https://github.com/python/typeshed/issues/4174"}
| 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:fa8f320f-da32-a16c-96ca-d0224e1b8d6a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 87D2:F5AA9:23C7345:30B4C6A:6B002F73 |
| html-safe-nonce | a843558e1781e3f40aae44930b9b36f6bdb9158a6ddc5047e2ebde5bc2d4a499 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4N0QyOkY1QUE5OjIzQzczNDU6MzBCNEM2QTo2QjAwMkY3MyIsInZpc2l0b3JfaWQiOiIyNDIxNTQ0NjI4MTg5NjcxMjgzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 03a811dd9525ada220fa48d82db8074928eb7113a284d6f1cf7c1043414dacec |
| hovercard-subject-tag | issue:630786437 |
| 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/4174/issue_layout |
| twitter:image | https://opengraph.githubassets.com/2f5fc5ab81447f2def3ca82c2fad69f1e275a05b3a9668ead88d57fe313aa8c2/python/typeshed/issues/4174 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/2f5fc5ab81447f2def3ca82c2fad69f1e275a05b3a9668ead88d57fe313aa8c2/python/typeshed/issues/4174 |
| og:image:alt | Now that we have a central stub for common types and protocols, we should think about how we name protocols in typeshed. Currently there is no common convention. Some possible conventions for a "re... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | srittau |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7d0829bbde9e48b2486cb5dd6d147896eb01d32134627091f818958a935ef3f0 |
| 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 | f3f3a43ca095cdea3abbb394112e971f9fdb94fa |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width