Title: Access to instance attribute with callable type causes error · Issue #6910 · python/mypy · GitHub
Open Graph Title: Access to instance attribute with callable type causes error · Issue #6910 · python/mypy
X Title: Access to instance attribute with callable type causes error · Issue #6910 · python/mypy
Description: test_dc.py: from dataclasses import dataclass, fields @dataclass class Foo: value: str fields(Foo)[0].default_factory $ mypy test_dc.py test_dc.py:9: error: Attribute function "default_factory" with type "Callable[[], Any]" does not acce...
Open Graph Description: test_dc.py: from dataclasses import dataclass, fields @dataclass class Foo: value: str fields(Foo)[0].default_factory $ mypy test_dc.py test_dc.py:9: error: Attribute function "default_factory" wit...
X Description: test_dc.py: from dataclasses import dataclass, fields @dataclass class Foo: value: str fields(Foo)[0].default_factory $ mypy test_dc.py test_dc.py:9: error: Attribute function "default_factory...
Opengraph URL: https://github.com/python/mypy/issues/6910
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Access to instance attribute with callable type causes error","articleBody":"test_dc.py:\r\n```\r\nfrom dataclasses import dataclass, fields\r\n\r\n\r\n@dataclass\r\nclass Foo:\r\n value: str\r\n\r\n\r\nfields(Foo)[0].default_factory\r\n```\r\n\r\n```\r\n$ mypy test_dc.py \r\ntest_dc.py:9: error: Attribute function \"default_factory\" with type \"Callable[[], Any]\" does not accept self argument\r\n```\r\n\r\npython version: `3.7.1`\r\nmypy version: `0.710+dev.95a04913df54d5b1ff78fcb9e7467b798491ec4b`","author":{"url":"https://github.com/unknownlighter","@type":"Person","name":"unknownlighter"},"datePublished":"2019-05-29T07:54:03Z","url":"https://github.com/python/mypy/issues/6910"}
| 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:5a402eea-9dbb-e2d4-16db-4b0103ccff84 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A230:14A3EB:1315C03:18F47C7:6B000573 |
| html-safe-nonce | 061baaa387f902d976f391eabb6cfb7af0e8a428063740eb8697de2886f31987 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBMjMwOjE0QTNFQjoxMzE1QzAzOjE4RjQ3Qzc6NkIwMDA1NzMiLCJ2aXNpdG9yX2lkIjoiNDMzMDMxNzM5MTE5NzExMTY2NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 6c2fd8f04776bb64f242b1a3d8694fbbdf28ffd96b15dc3128d24d5ac8f5f62f |
| hovercard-subject-tag | issue:449652194 |
| 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/6910/issue_layout |
| twitter:image | https://opengraph.githubassets.com/30bbf1cb1d7ecc0e321638e1a4cdb07c2d946aa6e5099022c6b4a941e5dff224/python/mypy/issues/6910 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/30bbf1cb1d7ecc0e321638e1a4cdb07c2d946aa6e5099022c6b4a941e5dff224/python/mypy/issues/6910 |
| og:image:alt | test_dc.py: from dataclasses import dataclass, fields @dataclass class Foo: value: str fields(Foo)[0].default_factory $ mypy test_dc.py test_dc.py:9: error: Attribute function "default_factory" wit... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | unknownlighter |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729 |
| 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 | 16a11879678aaf97e2a42c33ee70830aa084fa37 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width