<div class="gmail_quote">On Tue, Sep 21, 2010 at 4:44 PM, Benjamin Root <span dir="ltr"><<a href="mailto:ben.root@ou.edu">ben.root@ou.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

<div class="gmail_quote"><div class="im">On Tue, Sep 21, 2010 at 4:31 PM, Michael Gilbert <span dir="ltr"><<a href="mailto:michael.s.gilbert@gmail.com" target="_blank">michael.s.gilbert@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
Hi,<br>
<br>
The following example demonstrates a rather unexpected result:<br>
<br>
>>> import numpy<br>
>>> x = numpy.array( complex( 1.0 , 1.0 ) , numpy.object )<br>
>>> print x.real<br>
(1+1j)<br>
>>> print x.imag<br>
0<br>
<br>
Shouldn't real and imag return an error in such a situation?<br>
<br>
Thanks,<br>
Mike<br>
</blockquote></div><div><br>Don't use 'numpy.object'.  Because complex is a  numerical type, numpy can handle it just fine.  By setting dtype to numpy.object, numpy then treats it like an object rather than a numerical.<br>


<br>x = numpy.array( complex(1.0, 1.0) )<br><br>should work just fine.<br><br>I hope that helps!<br>Ben Root<br><br></div></div>
</blockquote></div><br>I see that I have interpreted this thread as "Doctor, it hurts when I do this...  Well, don't do that!"  Sorry for the noise.<br><br>Ben Root<br>