New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Document that float // float returns a float #102823
Comments
+1 Note that While you're at it, perhaps take a look at the docstring in
|
IOW, a Decimal. |
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
…thonGH-102824) (cherry picked from commit b72251d) Co-authored-by: Mark Dickinson <dickinsm@gmail.com> Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
…thonGH-102824) (cherry picked from commit b72251d) Co-authored-by: Mark Dickinson <dickinsm@gmail.com> Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Fixed via #102824 and backports to 3.11, thanks! |
PEP 238 states clearly that the result of
x // y
is afloat
, whenx
andy
both have typefloat
.And indeed this is the behaviour that's been in place since Python 2.2. However, we seem to be missing a clear statement of this in the official docs. It would be good to fix that.
Motivated by the thread https://discuss.python.org/t/make-float-floordiv-and-rfloordiv-return-an-int/24959, where it's been asserted that this behaviour is an 'implementation detail'.
Linked PRs
The text was updated successfully, but these errors were encountered: