<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/numpy/ticket/1618" rel="nofollow">http://projects.scipy.org/numpy/ticket/1618</a> on 2010-09-21 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/pv/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/pv">@pv</a>, assigned to unknown.</em></p>
<p dir="auto">It probably shouldn't do this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; import numpy as np
&gt;&gt;&gt; x = np.array(1+2j, object)
&gt;&gt;&gt; x.real
array((1+2j), dtype=object)"><pre class="notranslate"><code class="notranslate">&gt;&gt;&gt; import numpy as np
&gt;&gt;&gt; x = np.array(1+2j, object)
&gt;&gt;&gt; x.real
array((1+2j), dtype=object)
</code></pre></div>
<p dir="auto">The implementation of .real for object arrays seems suspicious.</p>
<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/numpy/ticket/1142" rel="nofollow">http://projects.scipy.org/numpy/ticket/1142</a> on 2009-06-19 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/inducer/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/inducer">@inducer</a>, assigned to unknown.</em></p>
<p dir="auto">numpy could really do a better job here by propagating the .real to the elements of the object array:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Python 2.5.4 (r254:67916, Feb 18 2009, 03:00:47) 
[GCC 4.3.3] on linux2
Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.
&gt;&gt;&gt; import numpy as n
&gt;&gt;&gt; n.__version__
'1.3.0'
&gt;&gt;&gt; a = n.array(5+7j)
&gt;&gt;&gt; b = n.array([a], dtype=object)
&gt;&gt;&gt; b.real
array([(5+7j)], dtype=object)
&gt;&gt;&gt; n.real(b)
array([(5+7j)], dtype=object)"><pre class="notranslate"><code class="notranslate">Python 2.5.4 (r254:67916, Feb 18 2009, 03:00:47) 
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt; import numpy as n
&gt;&gt;&gt; n.__version__
'1.3.0'
&gt;&gt;&gt; a = n.array(5+7j)
&gt;&gt;&gt; b = n.array([a], dtype=object)
&gt;&gt;&gt; b.real
array([(5+7j)], dtype=object)
&gt;&gt;&gt; n.real(b)
array([(5+7j)], dtype=object)
</code></pre></div>
<hr>
<p dir="auto">Summary by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/seberg/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/seberg">@seberg</a>:</p>
<p dir="auto">Object arrays could call <code class="notranslate">.real</code> on all objects, but that would not return a view as typically promised by <code class="notranslate">arr.real</code>. It seems that moving forward here may require a new function that returns a copy?</p>