[Numpy-discussion] Handling methods of object-arrays
Stéfan van der Walt
stefan at sun.ac.za
Tue Jan 6 04:15:45 EST 2009
Hi all,
What is the exact protocol for evaluating functions like "real" and
"imag" on object arrays?
For example, I'm looking at
x = np.array([np.array(3+1j), np.array(4+1j)], dtype=object)
For which both
In [4]: x.real
Out[4]: array([(3+1j), (4+1j)], dtype=object)
and
In [6]: np.real(x)
Out[6]: array([(3+1j), (4+1j)], dtype=object)
does nothing, so that I have to do
In [8]: [np.real(e) for e in x]
Out[8]: [array(3.0), array(4.0)]
or [e.real for e in x].
Would it make sense make np.real aware of the above scenario?
Regards
Stéfan
More information about the NumPy-Discussion
mailing list