Title: gh-84978: expose __float__ dunder method as as_float by skirpichev · Pull Request #110460 · python/cpython · GitHub
Open Graph Title: gh-84978: expose __float__ dunder method as as_float by skirpichev · Pull Request #110460 · python/cpython
X Title: gh-84978: expose __float__ dunder method as as_float by skirpichev · Pull Request #110460 · python/cpython
Description: This is a lightweight alternative for #26827 (an alternate constructor could be more discoverable option). Similar functions could be added for __complex__() and __int__() methods. But, probably, support of float subclasses in __float__() should be removed first (see #109311). Of course, this is not an equivalent to PyFloat_AsDouble(), which tries to use __index__() dunder if there is no __float__() one. But maybe it could serve at least as a partial solution for the issue? to decide: name: as_float vs float (c.f. index)? Issue: gh-84978 📚 Documentation preview 📚: https://cpython-previews--110460.org.readthedocs.build/
Open Graph Description: This is a lightweight alternative for #26827 (an alternate constructor could be more discoverable option). Similar functions could be added for __complex__() and __int__() methods. But, probably,...
X Description: This is a lightweight alternative for #26827 (an alternate constructor could be more discoverable option). Similar functions could be added for __complex__() and __int__() methods. But, probably,...
Opengraph URL: https://github.com/python/cpython/pull/110460
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:3d458067-3bdd-c98e-39c4-ae94524461e6 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 95FC:2C2A02:4C48F7E:6BC6254:6A4FC78D |
| html-safe-nonce | 33f13ae647a391cb305b8250ab2af965f942ca7958043ad7100a64e44446dd89 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NUZDOjJDMkEwMjo0QzQ4RjdFOjZCQzYyNTQ6NkE0RkM3OEQiLCJ2aXNpdG9yX2lkIjoiNzE1NDcwMDk0NjAzMDcwODYyMiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5670088f558f53b8ba7f30a2a337a1e76d2ae0537c66743716291c95f7f79242 |
| hovercard-subject-tag | pull_request:1544848573 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/python/cpython/pull/110460/files |
| twitter:image | https://avatars.githubusercontent.com/u/2155800?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/2155800?s=400&v=4 |
| og:image:alt | This is a lightweight alternative for #26827 (an alternate constructor could be more discoverable option). Similar functions could be added for __complex__() and __int__() methods. But, probably,... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 60b2ae4c725f51e2dac275d0ac5e9233e5967a61cdfaebd732f63da67ff1b71c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 06fb64e1cb36b9a7a2e3f0e6c14af40ef9f439d4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width