Title: Inference from unannotated functions · Issue #4455 · python/mypy · GitHub
Open Graph Title: Inference from unannotated functions · Issue #4455 · python/mypy
X Title: Inference from unannotated functions · Issue #4455 · python/mypy
Description: Mypy uses the body of unannotated functions for inference and to understand what attributes an object has. For example: d = {} e = {} def f(): d['x'] = 1 d['y'] = 2 e['y'] = 2 reveal_type(d) # dict[Any, Any] reveal_type(e) # dict[str, in...
Open Graph Description: Mypy uses the body of unannotated functions for inference and to understand what attributes an object has. For example: d = {} e = {} def f(): d['x'] = 1 d['y'] = 2 e['y'] = 2 reveal_type(d) # dict...
X Description: Mypy uses the body of unannotated functions for inference and to understand what attributes an object has. For example: d = {} e = {} def f(): d['x'] = 1 d['y'] = 2 e['y'] =...
Opengraph URL: https://github.com/python/mypy/issues/4455
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Inference from unannotated functions","articleBody":"Mypy uses the body of unannotated functions for inference and to understand what attributes an object has. For example:\r\n```\r\nd = {}\r\ne = {}\r\n\r\ndef f():\r\n d['x'] = 1\r\n\r\nd['y'] = 2\r\ne['y'] = 2\r\n\r\nreveal_type(d) # dict[Any, Any]\r\nreveal_type(e) # dict[str, int]\r\n```\r\nI couldn't find any mention of it on the docs. I think this behaviour needs to be documented. Perhaps as a separate section, to make it searchable.\r\n\r\nRelated: #4434 #4409\r\n","author":{"url":"https://github.com/elazarg","@type":"Person","name":"elazarg"},"datePublished":"2018-01-10T17:36:35Z","url":"https://github.com/python/mypy/issues/4455"}
| 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:fa7c04ee-c278-2826-04a3-f1b3b1d2253d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BDD8:2D8919:BE8538:FEF901:6B004DCE |
| html-safe-nonce | 73211e072a3d15e4f9af00cdfcbd724e4dbc7f6e072483568f02ca3a7f6aa28f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCREQ4OjJEODkxOTpCRTg1Mzg6RkVGOTAxOjZCMDA0RENFIiwidmlzaXRvcl9pZCI6IjUzNTkwNDY1MzUyNzc2NDQzMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3271c1aaa85d0999ad2ce03d20756962de5e0f85ac6060855721ee416064ad5d |
| hovercard-subject-tag | issue:287518403 |
| 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/4455/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6f2057cabeeaf51de9d03808051804e3c1556a6773ae58554d5ce0a24cb67c53/python/mypy/issues/4455 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6f2057cabeeaf51de9d03808051804e3c1556a6773ae58554d5ce0a24cb67c53/python/mypy/issues/4455 |
| og:image:alt | Mypy uses the body of unannotated functions for inference and to understand what attributes an object has. For example: d = {} e = {} def f(): d['x'] = 1 d['y'] = 2 e['y'] = 2 reveal_type(d) # dict... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | elazarg |
| hostname | github.com |
| expected-hostname | github.com |
| None | f9517bf360d46638a1e5e7daee7158842fe5ef43c9000afa0e127564a7c2f39b |
| 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 | b27c5dde30676028abd5c5fc53ce5c9b625f8281 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width