should ndarray implement __round__ for py3k?

A simple test in python 3:
import numpy as np round(np.arange(10)) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: type numpy.ndarray doesn't define __round__ method
Here is some additional context: http://bugs.python.org/issue7261 Darren

On Thu, Mar 25, 2010 at 15:01, Darren Dale <dsdale24@gmail.com> wrote:
A simple test in python 3:
import numpy as np round(np.arange(10)) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: type numpy.ndarray doesn't define __round__ method
Here is some additional context: http://bugs.python.org/issue7261
I'd put that in the "would be nice, but not a priority" category. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco

Darren Dale wrote:
A simple test in python 3:
import numpy as np round(np.arange(10)) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: type numpy.ndarray doesn't define __round__ method
I implemented this for array scalars already, but forgot about arrays. Anyway, it could be nice to have. -- Pauli Virtanen

On Thu, Mar 25, 2010 at 2:58 PM, Pauli Virtanen <pav@iki.fi> wrote:
Darren Dale wrote:
A simple test in python 3:
import numpy as np round(np.arange(10)) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: type numpy.ndarray doesn't define __round__ method
I implemented this for array scalars already, but forgot about arrays. Anyway, it could be nice to have.
I like the fact that python >= 3.1 returns integers when rounding floats. Chuck
participants (4)
-
Charles R Harris
-
Darren Dale
-
Pauli Virtanen
-
Robert Kern