[Numpy-discussion] real and imag functions should produce errors for object arrays

Pauli Virtanen pav@iki...
Tue Sep 21 17:17:37 CDT 2010


Tue, 21 Sep 2010 21:50:08 +0000, Pauli Virtanen wrote:

> Tue, 21 Sep 2010 17:31:55 -0400, Michael Gilbert wrote:
>> The following example demonstrates a rather unexpected result:
>> 
>>>>> import numpy
>>>>> x = numpy.array( complex( 1.0 , 1.0 ) , numpy.object )
>> print x.real
>> (1+1j)
>>>>> print x.imag
>> 0
>> 
>> Shouldn't real and imag return an error in such a situation?
> 
> It probably shouldn't do *that* at the least.

*that* == return a complex number from .real



More information about the NumPy-Discussion mailing list