Title: Follow PEP 8 recommendations for type variable names · Issue #1872 · python/typeshed · GitHub
Open Graph Title: Follow PEP 8 recommendations for type variable names · Issue #1872 · python/typeshed
X Title: Follow PEP 8 recommendations for type variable names · Issue #1872 · python/typeshed
Description: This appeared in #1856 The problem is that type variable names in some stubs don't follow PEP 8 that recommends short names. This recommendation exists for a reason: behaviour of some constructs is subtly different with type variables an...
Open Graph Description: This appeared in #1856 The problem is that type variable names in some stubs don't follow PEP 8 that recommends short names. This recommendation exists for a reason: behaviour of some constructs is...
X Description: This appeared in #1856 The problem is that type variable names in some stubs don't follow PEP 8 that recommends short names. This recommendation exists for a reason: behaviour of some construct...
Opengraph URL: https://github.com/python/typeshed/issues/1872
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Follow PEP 8 recommendations for type variable names","articleBody":"This appeared in https://github.com/python/typeshed/pull/1856\r\n\r\nThe problem is that type variable names in some stubs don't follow PEP 8 that recommends short names. This recommendation exists for a reason: behaviour of some constructs is subtly different with type variables and normal types, so it should be immediately clear that a given name refers to a type variable. Most notable examples are generic base classes and generic type aliases, where this leads to false negatives (unless `--disallow-any-generics` is used):\r\n```python\r\nLongNameLikeAClass = TypeVar('LongNameLikeAClass')\r\n# 300 lines later\r\nclass Cls(Iterable[LongNameLikeAClass]): # it's not obvious this class is generic\r\n ...\r\nAlias = Dict[str, List[LongNameLikeAClass]] # even more here, this looks like a normal alias\r\n\r\ndef fun(arg: Cls) -> Alias: # two `Any`s sneaked in here\r\n ...\r\n```\r\n(it is not something hypothetic, I have seen this kind of errors many times)\r\n\r\nI propose to replace the existing long type variable names to follow PEP 8 style. If someone really doesn't like short names, we could propose some other agreement, like end long type variable names with `_TVar`.","author":{"url":"https://github.com/ilevkivskyi","@type":"Person","name":"ilevkivskyi"},"datePublished":"2018-02-11T01:09:48Z","url":"https://github.com/python/typeshed/issues/1872"}
| 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:5ee9269f-6318-d375-260c-f7d512147b79 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 89F6:3DB50A:71AF9B:97F282:6B00390E |
| html-safe-nonce | 54564645a0c4ded70046fd5c436be54836fa22ff7d2e49cdb36713686939e0fb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OUY2OjNEQjUwQTo3MUFGOUI6OTdGMjgyOjZCMDAzOTBFIiwidmlzaXRvcl9pZCI6IjU0MDUyMTc2NDA4OTEzMDAxMTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | f76953b1182a81e2db450f0cade76eb39a565b2124ff8b494dc9636798926c16 |
| hovercard-subject-tag | issue:296149250 |
| 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/1872/issue_layout |
| twitter:image | https://opengraph.githubassets.com/af239ea2cdbaa40cf1b57bf4ffba094f5056f249f8f289bb93515d4c8369cee2/python/typeshed/issues/1872 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/af239ea2cdbaa40cf1b57bf4ffba094f5056f249f8f289bb93515d4c8369cee2/python/typeshed/issues/1872 |
| og:image:alt | This appeared in #1856 The problem is that type variable names in some stubs don't follow PEP 8 that recommends short names. This recommendation exists for a reason: behaviour of some constructs is... |
| 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 | 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