[Numpy-discussion] Multiplying Python float to numpy.array of objects works but fails with a numpy.float64, numpy Bug?

Pauli Virtanen pav@iki...
Tue Jun 9 13:08:43 CDT 2009


Sun, 07 Jun 2009 12:09:40 +0200, Sebastian Walter wrote:
> from numpy import *
> import numpy
> print 'numpy.__version__=',numpy.__version__
> 
> class adouble:
>        def __init__(self,x):
>                self.x = x
>        def __mul__(self,rhs):
>                if isinstance(rhs,adouble):
>                        return adouble(self.x * rhs.x)
>                else:
>                        return adouble(self.x * rhs)
>        def __str__(self):
>                return str(self.x)
[clip]
> print u * float64(3.)    # _NOT_ OK!
[clip]
> 
> Should I open a ticket for that?

Please do, the current behavior doesn't seem correct.

-- 
Pauli Virtanen



More information about the Numpy-discussion mailing list