<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/numpy/ticket/1208" rel="nofollow">http://projects.scipy.org/numpy/ticket/1208</a> on 2009-08-26 by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/stefanv/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/stefanv">@stefanv</a>, assigned to unknown.</em></p>
<p dir="auto">Considering</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="x  = np.array([np.array(3+1j), np.array(4+1j)], dtype=object)"><pre class="notranslate"><code class="notranslate">x  = np.array([np.array(3+1j), np.array(4+1j)], dtype=object)
</code></pre></div>
<p dir="auto">both</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [4]: x.real
Out[4]: array([(3+1j), (4+1j)], dtype=object)"><pre class="notranslate"><code class="notranslate">In [4]: x.real
Out[4]: array([(3+1j), (4+1j)], dtype=object)
</code></pre></div>
<p dir="auto">and</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [6]: np.real(x)
Out[6]: array([(3+1j), (4+1j)], dtype=object)"><pre class="notranslate"><code class="notranslate">In [6]: np.real(x)
Out[6]: array([(3+1j), (4+1j)], dtype=object)
</code></pre></div>
<p dir="auto">does nothing, so that you have to do</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [8]: [np.real(e) for e in x]
Out[8]: [array(3.0), array(4.0)]"><pre class="notranslate"><code class="notranslate">In [8]: [np.real(e) for e in x]
Out[8]: [array(3.0), array(4.0)]
</code></pre></div>
<p dir="auto">or [e.real for e in x].</p>
<p dir="auto">We should check for the real method of e.</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>