Message335878
The open question in my mind is which is the least surprising definition of a//b. Should it be math.floor(a/b) or divmod(a,b)[0]?
The advantage of the former is that floor(a/b) is arguably the definition of floor division. The advantage of the latter is that a//b, a%b, and divmod(a,b) are consistent with one another.
FWIW, it looks like NumPy and PyPy made the same design choice as CPython:
>>> a = numpy.array([4.0, 4.0, 4.0], dtype=numpy.float64)
>>> b = numpy.array([0.4, 0.5, 0.6], dtype=numpy.float64)
>>> a / b
array([10. , 8. , 6.66666667])
>>> a // b
array([9., 8., 6.])
$ pypy3
Python 3.5.3 (fdd60ed87e941677e8ea11acf9f1819466521bf2, Apr 26 2018, 01:25:35)
[PyPy 6.0.0 with GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>> 4.0 / 0.4
10.0
>>>> 4.0 // 0.4
9.0 |
|
Date |
User |
Action |
Args |
2019-02-19 01:31:39 | rhettinger | set | recipients:
+ rhettinger, tim.peters, mark.dickinson, steven.daprano, skrah, remi.lapeyre, Au Vo |
2019-02-19 01:31:39 | rhettinger | set | messageid: <1550539899.11.0.56089459789.issue36028@roundup.psfhosted.org> |
2019-02-19 01:31:39 | rhettinger | link | issue36028 messages |
2019-02-19 01:31:38 | rhettinger | create | |
|