Hi all,
here's something I don't understand. Consider the following code snippet:
---
class A(object):
def __radd__(self, other):
print(type(other))
import numpy as np
np.complex64(1j) + A()
On Wed, Feb 1, 2012 at 12:26 PM, Andreas Kloeckner
li...@informa.tiker.netwrote:
Hi all,
here's something I don't understand. Consider the following code snippet:
---
class A(object):
def __radd__(self, other):
print(type(other))
This seems odd to me. Unraveling what is going on (so far):
Let a = np.complex64(1j) and b = A()
* np.complex64.__add__ is calling np.add
* np.add(a, b) needs to search for an add loop that matches the input
types and it finds one with signature
Hey Andreas,
As previously described: what changes the type of np.complex64(1j) during the
A() call is that when a is an array scalar it is converted to an object array
because that is the only signature that matches. During this conversion, what
is extracted from the object array is piped