Title: float**float return type · Issue #1406 · python/typeshed · GitHub
Open Graph Title: float**float return type · Issue #1406 · python/typeshed
X Title: float**float return type · Issue #1406 · python/typeshed
Description: float**float is currently defined as returning float, but in Python 3, (negative float) ** (non-whole float) returns a complex number. (In Python 2 it raises ValueError.) I'm not sure what to do about this -- in mypy a plugin won't be ve...
Open Graph Description: float**float is currently defined as returning float, but in Python 3, (negative float) ** (non-whole float) returns a complex number. (In Python 2 it raises ValueError.) I'm not sure what to do ab...
X Description: float**float is currently defined as returning float, but in Python 3, (negative float) ** (non-whole float) returns a complex number. (In Python 2 it raises ValueError.) I'm not sure what to d...
Opengraph URL: https://github.com/python/typeshed/issues/1406
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"float**float return type","articleBody":"float**float is currently defined as returning float, but in Python 3, (negative float) ** (non-whole float) returns a complex number. (In Python 2 it raises ValueError.)\r\n\r\nI'm not sure what to do about this -- in mypy a plugin won't be very effective, because typically the sign of the base (left operand) is not known statically (as opposed to the exponent, which is often a literal, which is how we addressed this for int**(negative int)).\r\n\r\nDeclaring the result a complex is technically correct (since float is effectively a subclass of complex, just like int is effectively a subclass of float), but probably going to be a pain. Making it Union[float, complex] is likely worse. Keeping it float is a lie and may lead to unanticipated errors, and making it Any (like we do for int**int when we don't know the sign of the exponent) a cop-out that just hides more errors.\r\n\r\nAll in all I think we should change this to complex, even if it's a pain. Any other opinions?","author":{"url":"https://github.com/gvanrossum","@type":"Person","name":"gvanrossum"},"datePublished":"2017-06-13T16:21:20Z","url":"https://github.com/python/typeshed/issues/1406"}
| 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:dc3bc602-3d14-6c72-2b75-f9de1e814228 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B6B8:34D7A7:ADA944:E9B50A:6B004D2C |
| html-safe-nonce | b47a66aea21be6c50c8b24d906ce2e5bf71cddc982929f6b5059b0b1a1111f95 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNkI4OjM0RDdBNzpBREE5NDQ6RTlCNTBBOjZCMDA0RDJDIiwidmlzaXRvcl9pZCI6IjI5Njk0NDE5MjgxMjQzMjEwNjgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7c51f4fbdf20f0b8b33c395b85687659dd4c74f79416abdee6108855e2a89aea |
| hovercard-subject-tag | issue:235611127 |
| 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/1406/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8a870499e27d0fbf0a4f08b49472850ecc67a326d6c5a713ee2d25dd210721c4/python/typeshed/issues/1406 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8a870499e27d0fbf0a4f08b49472850ecc67a326d6c5a713ee2d25dd210721c4/python/typeshed/issues/1406 |
| og:image:alt | float**float is currently defined as returning float, but in Python 3, (negative float) ** (non-whole float) returns a complex number. (In Python 2 it raises ValueError.) I'm not sure what to do ab... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gvanrossum |
| hostname | github.com |
| expected-hostname | github.com |
| None | f9517bf360d46638a1e5e7daee7158842fe5ef43c9000afa0e127564a7c2f39b |
| 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 | b27c5dde30676028abd5c5fc53ce5c9b625f8281 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width