Change in ``round`` behavior for numpy scalars in python 3

Sept. 15, 2012
7:15 a.m.
Hi, I just noticed that Python 3 raises an error for 0 dimensional numpy arrays. Here's Python 2.6: In [14]: a = np.array(1.1) In [15]: round(a) Out[15]: 1.0 and Python 3.2: In [3]: a = np.array(1.1) In [4]: round(a) --------------------------------------------------------------------------- TypeError Traceback (most recent call last) /Users/mb312/dev_trees/<ipython-input-4-7736a3ba67a1> in <module>() ----> 1 round(a) TypeError: type numpy.ndarray doesn't define __round__ method Should arrays implement __round__ ? Returning an error for 1D or above? Best, Matthew
4543
Age (days ago)
4543
Last active (days ago)
0 comments
1 participants
participants (1)
-
Matthew Brett