[Numpy-discussion] should ndarray implement __round__ for py3k?

Charles R Harris charlesr.harris at gmail.com
Thu Mar 25 17:01:56 EDT 2010


On Thu, Mar 25, 2010 at 2:58 PM, Pauli Virtanen <pav at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20100325/c53c5ccb/attachment.html>


More information about the NumPy-Discussion mailing list