-
Notifications
You must be signed in to change notification settings - Fork 2
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
Division in place acts differently according to Python version #120
Comments
Beware that in py3 you have two division operators: |
https://www.python.org/dev/peps/pep-0238/
Probably we could use |
@grzanka this too probably should be resolved before release to pypy? |
Yes. I was thinking a bit more about it and the conclusion was that we should prefer floats over ints. |
According to this PEP: https://www.python.org/dev/peps/pep-0238/
For Python 2:
Classic division (default in Python 2)>>> 1 / 2 # integer truncation (floor division)
0
>>> 1.0 / 2.0 # returns real quotient (true division)
0.5 True division>>> from __future__ import division # 2.2+-only
>>>
>>> 1 / 2 # returns real quotient
0.5
>>> 1.0 / 2.0 # returns real quotient
0.5 As said earlier - true division is default for Python 3.x, so is Oh, and |
This doctest works in py2.7, fails in 3.4.
py3:
With
allow_cast=True
both act the same and pass.The text was updated successfully, but these errors were encountered: