Title: Pow doesn't infer types when variables are used · Issue #16635 · python/mypy · GitHub
Open Graph Title: Pow doesn't infer types when variables are used · Issue #16635 · python/mypy
X Title: Pow doesn't infer types when variables are used · Issue #16635 · python/mypy
Description: Bug Report I would expect that using variables to hold my values doesn't lose the resulting type. Sample code: my_wanted_int = 2 ** 3 reveal_type(my_wanted_int) # = int my_2 = 2 my_3 = 3 reveal_type(my_2) # = int reveal_type(my_3) # = in...
Open Graph Description: Bug Report I would expect that using variables to hold my values doesn't lose the resulting type. Sample code: my_wanted_int = 2 ** 3 reveal_type(my_wanted_int) # = int my_2 = 2 my_3 = 3 reveal_typ...
X Description: Bug Report I would expect that using variables to hold my values doesn't lose the resulting type. Sample code: my_wanted_int = 2 ** 3 reveal_type(my_wanted_int) # = int my_2 = 2 my_3 = 3 reveal...
Opengraph URL: https://github.com/python/mypy/issues/16635
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Pow doesn't infer types when variables are used","articleBody":"\u003c!--\r\nIf you're not sure whether what you're experiencing is a mypy bug, please see the \"Question and Help\" form instead.\r\nPlease consider:\r\n\r\n- checking our common issues page: https://mypy.readthedocs.io/en/stable/common_issues.html\r\n- searching our issue tracker: https://github.com/python/mypy/issues to see if it's already been reported\r\n- asking on gitter chat: https://gitter.im/python/typing\r\n-->\r\n\r\n**Bug Report**\r\n\r\nI would expect that using variables to hold my values doesn't lose the resulting type.\r\n\r\nSample code:\r\n```python\r\nmy_wanted_int = 2 ** 3\r\nreveal_type(my_wanted_int) # = int\r\n\r\nmy_2 = 2\r\nmy_3 = 3\r\nreveal_type(my_2) # = int\r\nreveal_type(my_3) # = int\r\nstar_result2 = my_2 ** my_3\r\nreveal_type(star_result2) # = Any\r\n```\r\n\r\n**Actual Behavior**\r\n\r\n```\r\n$ mypy -V\r\nmypy 1.7.1 (compiled: yes)\r\n$ mypy -c \"\r\nmy_wanted_int = 2 ** 3\r\nreveal_type(my_wanted_int) # = int\r\n\r\nmy_2 = 2\r\nmy_3 = 3\r\nreveal_type(my_2) # = int\r\nreveal_type(my_3) # = int\r\nstar_result2 = my_2 ** my_3\r\nreveal_type(star_result2) # = Any instead of int\r\n\"\r\n\u003cstring>:3: note: Revealed type is \"builtins.int\"\r\n\u003cstring>:7: note: Revealed type is \"builtins.int\"\r\n\u003cstring>:8: note: Revealed type is \"builtins.int\"\r\n\u003cstring>:10: note: Revealed type is \"Any\"\r\nSuccess: no issues found in 1 source file\r\n```\r\n\r\nHere is the example in the mypy playground:\r\nhttps://mypy-play.net/?mypy=latest&python=3.11&gist=e53d4334e01415845108453985c8f88f\r\n\r\n**Your Environment**\r\n\r\n\r\n- Mypy version used: 1.7.1\r\n- Python version used: 3.11\r\n","author":{"url":"https://github.com/GatienBouyer","@type":"Person","name":"GatienBouyer"},"datePublished":"2023-12-08T07:14:59Z","url":"https://github.com/python/mypy/issues/16635"}
| 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:464ea0d4-329f-048a-d48c-16462d40e670 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8DFA:BACA4:2CFE17A:3B7C590:6B002236 |
| html-safe-nonce | 1c6a3b038243dd212612a38f5a224fb94c1b84e7d797b4d9514400c0e55102f9 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4REZBOkJBQ0E0OjJDRkUxN0E6M0I3QzU5MDo2QjAwMjIzNiIsInZpc2l0b3JfaWQiOiI3NTg3ODYyMTI0NTU5MzQ0MTgyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | c64ddcf4fee63f17120cf76e2f569b57da589c42283a35c1bd91d0d503823fc4 |
| hovercard-subject-tag | issue:2032066996 |
| 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/16635/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4de05f79c0b21548e6f2933128b9779186014e9d3190fbd38f4e2f107260de9a/python/mypy/issues/16635 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4de05f79c0b21548e6f2933128b9779186014e9d3190fbd38f4e2f107260de9a/python/mypy/issues/16635 |
| og:image:alt | Bug Report I would expect that using variables to hold my values doesn't lose the resulting type. Sample code: my_wanted_int = 2 ** 3 reveal_type(my_wanted_int) # = int my_2 = 2 my_3 = 3 reveal_typ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | GatienBouyer |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4eb4cba0d69f045374ac15de9666d22b0961e1d555cc3824f36b7734c00c78e0 |
| 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 | 44c658b24abf00491fb7ae5f56d42c9f38cbeab2 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width