Title: Current typehints for `numbers.py` are worse than useless. · Issue #14290 · python/typeshed · GitHub
Open Graph Title: Current typehints for `numbers.py` are worse than useless. · Issue #14290 · python/typeshed
X Title: Current typehints for `numbers.py` are worse than useless. · Issue #14290 · python/typeshed
Description: While I understand that typing this module correctly is hard (or even impossible currently) to do, the current situation makes it impossible to use in a sane way since even the most simple of expressions result in false type errors. It w...
Open Graph Description: While I understand that typing this module correctly is hard (or even impossible currently) to do, the current situation makes it impossible to use in a sane way since even the most simple of expre...
X Description: While I understand that typing this module correctly is hard (or even impossible currently) to do, the current situation makes it impossible to use in a sane way since even the most simple of expre...
Opengraph URL: https://github.com/python/typeshed/issues/14290
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Current typehints for `numbers.py` are worse than useless.","articleBody":"While I understand that typing this module correctly is hard (or even impossible currently) to do, the current situation makes it impossible to use in a sane way since even the most simple of expressions result in false type errors. It would honestly be better to just not have any typing stubs for this module instead of the current ones. Two examples:\n\n```python\ndef f1(a: Complex, b: Complex) -> Complex:\n return a * b\n\ndef f2(a: Complex, b: Complex) -> Any:\n return a * b + b * a\n```\n\nBoth of these functions result in error messages which might *technically* be correct in the sense that there are types out there for which these are errors at runtime, but the fact that you can't write them without type ignores or casts means that using this module in combination with type checking is counter productive for finding errors.\n\nIt would be strictly better to just remove the `_ComplexLike` protocol and just make subclasses require type ignores in their method definitions - it's more important for the users (like in the above example) to not have to provide type ignores than for implementers - there are fewer implementers and they probably have a clearer understanding of the edge cases to be aware of.","author":{"url":"https://github.com/MegaIng","@type":"Person","name":"MegaIng"},"datePublished":"2025-06-16T23:22:13Z","url":"https://github.com/python/typeshed/issues/14290"}
| 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:b68cb5a4-32f1-9656-96e4-1e5dad5714b8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B308:28B491:C1AC3F:FBCB22:6AFFF13D |
| html-safe-nonce | 090301a8e8d67fdd0e3fd6b7f59ca351938a497462aa292516139a2bebb7f2df |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMzA4OjI4QjQ5MTpDMUFDM0Y6RkJDQjIyOjZBRkZGMTNEIiwidmlzaXRvcl9pZCI6IjQ3NDAxMjM0MjY2MTY3NjY3ODEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | c99b9da8a60d94a91e12a93278d740cb6481b56c5f0f1da50af8e000bf08452b |
| hovercard-subject-tag | issue:3151586791 |
| 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/14290/issue_layout |
| twitter:image | https://opengraph.githubassets.com/9c5e689486ccb7fac1093288446c4655f94b9f24995e1cfca0e28b0d37ed4730/python/typeshed/issues/14290 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/9c5e689486ccb7fac1093288446c4655f94b9f24995e1cfca0e28b0d37ed4730/python/typeshed/issues/14290 |
| og:image:alt | While I understand that typing this module correctly is hard (or even impossible currently) to do, the current situation makes it impossible to use in a sane way since even the most simple of expre... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | MegaIng |
| hostname | github.com |
| expected-hostname | github.com |
| None | 0a0d8686a27478df474dd7415776a7a080cde8838b3cd92ea7601187572e5729 |
| 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 | 16a11879678aaf97e2a42c33ee70830aa084fa37 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width