Title: Replace `float` with `float | int` · Issue #16059 · python/typeshed · GitHub
Open Graph Title: Replace `float` with `float | int` · Issue #16059 · python/typeshed
X Title: Replace `float` with `float | int` · Issue #16059 · python/typeshed
Description: As discussed in python/typing#1748: I propose to (slowly) replace float with float | int and complex with complex | float | int, where applicable. It's more correct, even if float is current implicitly equivalent to int | float. We are a...
Open Graph Description: As discussed in python/typing#1748: I propose to (slowly) replace float with float | int and complex with complex | float | int, where applicable. It's more correct, even if float is current implic...
X Description: As discussed in python/typing#1748: I propose to (slowly) replace float with float | int and complex with complex | float | int, where applicable. It's more correct, even if float is current im...
Opengraph URL: https://github.com/python/typeshed/issues/16059
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Replace `float` with `float | int`","articleBody":"As discussed in python/typing#1748: I propose to (slowly) replace `float` with `float | int` and `complex` with `complex | float | int`, where applicable.\n\n* It's more correct, even if `float` is current implicitly equivalent to `int | float`.\n* We are already prepared should the implicit promotion ever be removed.\n* We give type checkers the ability to optionally disable the promotion so that type checker authors and users can experiment with it.\n* Typeshed would always need to be the first step for this, so let's remove this blocker.\n\nThis issue proposes an ugly and slow, but correct and safe procedure:\n\n1. [x] Disable flake8-pyi code [Y041](https://github.com/PyCQA/flake8-pyi/blob/main/ERRORCODES.md#Y041).\n #16096\n2. [x] Introduce two type aliases `FloatInt = float | int` and `ComplexInt = complex | float | int` to `_typeshed`.\n #16068\n3. [x] Replace `complex` with either `complex` or a union; remove `ComplexInt` again.\n #16743\n4. [ ] Globally replace all instances of `float` with `FloatInt` in the stdlib.\n #16788\n6. [ ] Globally replace all instances of `float` with `FloatInt` in third-party stubs.\n #16789 \n8. [ ] Review `FloatInt` instances are replace them with the proper types. (This will take a while.)\n9. [ ] Remove the type alias once they are not needed anymore (in 10 years or so ...)Using `FloatInt` and `ComplexInt` would be disallowed for new code and the type aliases should explicitly be marked as not to be used by non-typeshed code.\n\nWe should also probably add flake8-pyi checks that checks that argument types use `float | int` and `complex | float | int`. Cases where only `float`/`complex` is allowed are probably rare.","author":{"url":"https://github.com/srittau","@type":"Person","name":"srittau"},"datePublished":"2026-07-21T11:10:05Z","url":"https://github.com/python/typeshed/issues/16059"}
| 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:9a11b5df-1202-f3ee-a5eb-bab2e6ee7c1b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 810C:163C4C:2221B0:2BE739:6AFF85B5 |
| html-safe-nonce | c6a4b95310b791f01a7a1a0c260621f8a1ffe1902ad49ce74778e086e22ac258 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MTBDOjE2M0M0QzoyMjIxQjA6MkJFNzM5OjZBRkY4NUI1IiwidmlzaXRvcl9pZCI6IjgwNjEyODkyNDc1MTc5MTU0MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | b4b9b6f923a8db4383147545b257f5bf183884a3796f2cbbd04437a5325235ca |
| hovercard-subject-tag | issue:4938177180 |
| 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/16059/issue_layout |
| twitter:image | https://opengraph.githubassets.com/949651c6c9ec721684552685608aca5f060d6a6d15b78959526c935e9aecd3b0/python/typeshed/issues/16059 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/949651c6c9ec721684552685608aca5f060d6a6d15b78959526c935e9aecd3b0/python/typeshed/issues/16059 |
| og:image:alt | As discussed in python/typing#1748: I propose to (slowly) replace float with float | int and complex with complex | float | int, where applicable. It's more correct, even if float is current implic... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | srittau |
| hostname | github.com |
| expected-hostname | github.com |
| None | 587ad99a3e443b2e1cb0d3df059ec49ab54389861f13310766dfdeb615fed90d |
| 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 | 5bb0fb68d64881d1344f5863d809515d496801e5 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width