Title: Error when accessing attribute of inner class · Issue #3635 · python/mypy · GitHub
Open Graph Title: Error when accessing attribute of inner class · Issue #3635 · python/mypy
X Title: Error when accessing attribute of inner class · Issue #3635 · python/mypy
Description: test_inner_class_attribute.py: class Foo: class Meta: name = 'Roy' print(Foo().Meta.name) Python executes the code just fine: $ python3.6 test_inner_class_attribute.py Roy But mypy fails to typecheck $ mypy test_inner_class_attribute.py ...
Open Graph Description: test_inner_class_attribute.py: class Foo: class Meta: name = 'Roy' print(Foo().Meta.name) Python executes the code just fine: $ python3.6 test_inner_class_attribute.py Roy But mypy fails to typeche...
X Description: test_inner_class_attribute.py: class Foo: class Meta: name = 'Roy' print(Foo().Meta.name) Python executes the code just fine: $ python3.6 test_inner_class_attribute.py Roy But mypy fails to...
Opengraph URL: https://github.com/python/mypy/issues/3635
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Error when accessing attribute of inner class","articleBody":"test_inner_class_attribute.py:\r\n```python\r\nclass Foo:\r\n class Meta:\r\n name = 'Roy'\r\n\r\nprint(Foo().Meta.name)\r\n```\r\n\r\nPython executes the code just fine:\r\n\r\n```bash\r\n$ python3.6 test_inner_class_attribute.py\r\nRoy\r\n```\r\n\r\nBut mypy fails to typecheck\r\n\r\n```bash\r\n$ mypy test_inner_class_attribute.py\r\ntest_inner_class_attribute.py:5: error: Member \"Meta\" is not assignable\r\n```\r\n\r\nThis pattern is super common in the [Django Rest Framework](http://www.django-rest-framework.org/api-guide/fields/#readonlyfield), [Marshmallow](http://marshmallow.readthedocs.io/en/latest/api_reference.html#marshmallow.Schema.Meta), and [PynamoDB](http://pynamodb.readthedocs.io/en/latest/tutorial.html#defining-a-model) projects (Probably more that I don't know about as well 😄 )","author":{"url":"https://github.com/rowillia","@type":"Person","name":"rowillia"},"datePublished":"2017-06-29T20:09:03Z","url":"https://github.com/python/mypy/issues/3635"}
| 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:34a7d0cb-fe09-1a9f-2736-8ef9ca2404d8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8930:1B0A31:2C66F05:3CC0AEB:6B005D95 |
| html-safe-nonce | ea4947aba942c3cd04d3bd700fb6756c7264dce638a3361e270129904f7a8ef6 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OTMwOjFCMEEzMToyQzY2RjA1OjNDQzBBRUI6NkIwMDVEOTUiLCJ2aXNpdG9yX2lkIjoiNDE1MzUwNjc2NDU4MDQ3ODM1NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 113909d0e4cd0c42c076a5646ac74c74c5de6da75cde3ec7885190f0952c5e92 |
| hovercard-subject-tag | issue:239596594 |
| 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/mypy/3635/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3339b0a91b6e0253999b18c3b87ad45a2619f605b8d64b405ffe566426e78f56/python/mypy/issues/3635 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3339b0a91b6e0253999b18c3b87ad45a2619f605b8d64b405ffe566426e78f56/python/mypy/issues/3635 |
| og:image:alt | test_inner_class_attribute.py: class Foo: class Meta: name = 'Roy' print(Foo().Meta.name) Python executes the code just fine: $ python3.6 test_inner_class_attribute.py Roy But mypy fails to typeche... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rowillia |
| hostname | github.com |
| expected-hostname | github.com |
| None | 29be975efff6507a5d135de9c7d634cf7ff8f0c55222a64386ab3202209aaf73 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/mypy git https://github.com/python/mypy.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 7053637 |
| octolytics-dimension-repository_nwo | python/mypy |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7053637 |
| octolytics-dimension-repository_network_root_nwo | python/mypy |
| 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 | eacd927ba6112e3b01ba99c762bd699a4a4f5df7 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width