Title: Consider adding `__slots__` to stubs? · Issue #8832 · python/typeshed · GitHub
Open Graph Title: Consider adding `__slots__` to stubs? · Issue #8832 · python/typeshed
X Title: Consider adding `__slots__` to stubs? · Issue #8832 · python/typeshed
Description: Since mypy now supports __slots__ checking, we can add __slots__ to stubs. This will allow us to correctly raise Something is not in __slots__ when assigning extra attributes. Right now there are no __slots__ defined: https://github.com/...
Open Graph Description: Since mypy now supports __slots__ checking, we can add __slots__ to stubs. This will allow us to correctly raise Something is not in __slots__ when assigning extra attributes. Right now there are n...
X Description: Since mypy now supports __slots__ checking, we can add __slots__ to stubs. This will allow us to correctly raise Something is not in __slots__ when assigning extra attributes. Right now there are n...
Opengraph URL: https://github.com/python/typeshed/issues/8832
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Consider adding `__slots__` to stubs?","articleBody":"Since mypy now supports `__slots__` checking, we can add `__slots__` to stubs.\r\nThis will allow us to correctly raise `Something is not in __slots__` when assigning extra attributes.\r\n\r\nRight now there are no `__slots__` defined: https://github.com/python/typeshed/search?q=__slots__\r\n\r\nIf this is something we are going for, there are several things to consider:\r\n1. Adding this feature to `stubtest`. It can check that `__slots__` contents do match. Probably behind a feature flag. We can enable it for `stdlib` only\r\n2. Should we allow skipping `_protected` attributes? For example, if some class is defined as\r\n ```python\r\n class A:\r\n __slots__ = ('_prop',)\r\n ```\r\n\r\n Should we allow this stub?\r\n\r\n ```python\r\n class A:\r\n __slots__ = ()\r\n ```\r\n","author":{"url":"https://github.com/sobolevn","@type":"Person","name":"sobolevn"},"datePublished":"2022-10-03T17:34:36Z","url":"https://github.com/python/typeshed/issues/8832"}
| 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:1d850dd2-d1b2-013a-b9cd-f3c8033262bd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B956:396A8E:1475F05:1B12298:6B001A5A |
| html-safe-nonce | 6c7a552b6fc62e890062caad7d7e2b16c42896ff20c1d5495c556b930c7d070b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCOTU2OjM5NkE4RToxNDc1RjA1OjFCMTIyOTg6NkIwMDFBNUEiLCJ2aXNpdG9yX2lkIjoiNTI0MjE3MzU2MDI1NjAwNjAyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | de6162df8a0c9551b8275d36cccb6d3b3a331f1e7c4b6c9ae3e00f20367f8199 |
| hovercard-subject-tag | issue:1395085815 |
| 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/8832/issue_layout |
| twitter:image | https://opengraph.githubassets.com/0e9e6d09c677ca8df189e6db41c151d60b6ef70de705d479514c8c97ef4163d4/python/typeshed/issues/8832 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/0e9e6d09c677ca8df189e6db41c151d60b6ef70de705d479514c8c97ef4163d4/python/typeshed/issues/8832 |
| og:image:alt | Since mypy now supports __slots__ checking, we can add __slots__ to stubs. This will allow us to correctly raise Something is not in __slots__ when assigning extra attributes. Right now there are n... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | sobolevn |
| hostname | github.com |
| expected-hostname | github.com |
| None | a2dd2291b1b13cc9c06f27ec92fa3dbaf34116fc24c9347b8539db61884c59f4 |
| 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 | 70121d4e855ee0bb7b75cf15d061d91f8863c0f8 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width