<br><br><div class="gmail_quote">2011/11/15 MACKEITH Andrew <span dir="ltr"><<a href="mailto:Andrew.MACKEITH@3ds.com">Andrew.MACKEITH@3ds.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">





<div link="blue" vlink="purple" lang="EN-US">
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:10.0pt">From:</span></b><span style="font-size:10.0pt"> <a href="mailto:numpy-discussion-bounces@scipy.org" target="_blank">numpy-discussion-bounces@scipy.org</a> [mailto:<a href="mailto:numpy-discussion-bounces@scipy.org" target="_blank">numpy-discussion-bounces@scipy.org</a>]
<b>On Behalf Of </b>Olivier Delalleau<br>
<b>Sent:</b> Tuesday, November 15, 2011 7:03 AM<br>
<b>To:</b> Discussion of Numerical Python<br>
<b>Subject:</b> Re: [Numpy-discussion] numpy.int32 is not subclass of int, but numpy.int64 is</span></p>
</div>
<p class="MsoNormal"> </p>
<p class="MsoNormal">2011/11/14 Robert Kern <<a href="mailto:robert.kern@gmail.com" target="_blank">robert.kern@gmail.com</a>></p>
<div><div><div class="h5">
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">On Mon, Nov 14, 2011 at 20:18, MACKEITH Andrew <<a href="mailto:Andrew.MACKEITH@3ds.com" target="_blank">Andrew.MACKEITH@3ds.com</a>> wrote:<br>
> Could someone explain this?<br>
><br>
> An instance of numpy.int32 is not an instance of int or <a href="http://numpy.int" target="_blank">
numpy.int</a>.<br>
> An instance of numpy.int64 is an instance of int and <a href="http://numpy.int" target="_blank">
numpy.int</a>.<br>
><br>
> I don't know if it is a bug in my linux build.</p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt">>>>> import sys<br>
>>>> sys.maxint<br>
> 9223372036854775807<br>
>>>> import platform<br>
>>>> print  platform.platform()<br>
> Linux-2.6.32.12-0.7-default-x86_64-with-SuSE-11-x86_64</p>
</div>
<p class="MsoNormal">This is expected on a 64-bit platform. Note that <a href="http://numpy.int" target="_blank">
numpy.int</a> is just an<br>
alias for the builtin int type for backwards compatibility with an<br>
earlier version of numpy. We could probably remove it, since it seems<br>
to be causing more confusion than not.<br>
<br>
Anyways, we subclass the appropriately sized integer scalar type from<br>
Python's int type depending on the platform. So on a platform where<br>
Python's int type is 64-bits, numpy.int64 will include int in its<br>
inheritance tree. On platforms where the Python int type is 32-bit,<br>
numpy.int32 will include it instead.</p>
</blockquote>
</div></div><div><div><div class="h5">
<p class="MsoNormal"><br>
I'll just add that there is a numpy.integer class that is parent of both numpy.int32 and numpy.int64 (see
<a href="http://docs.scipy.org/doc/numpy/reference/arrays.scalars.html" target="_blank">http://docs.scipy.org/doc/numpy/reference/arrays.scalars.html</a>). It's not a parent of
<a href="http://numpy.int" target="_blank">numpy.int</a> though, since as said above, <a href="http://numpy.int" target="_blank">
numpy.int</a> is an alias to the builtin int.<br>
<br>
-=- Olivier</p>
<p class="MsoNormal"><span style="font-family:"Rockwell","serif";color:#1F497D"> </span></p>
</div></div><p class="MsoNormal"><span style="font-family:"Rockwell","serif";color:#1F497D">Thanks you for the information.  numpy.integer is what I was looking for. 
</span></p>
<p class="MsoNormal"><span style="font-family:"Rockwell","serif";color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-family:"Rockwell","serif";color:#1F497D">Is there an equivalent base class for float types?</span></p>
<p class="MsoNormal"><span style="font-family:"Rockwell","serif";color:#1F497D">Do you know where these are documented?</span></p><span class="HOEnZb"><font color="#888888">
<p class="MsoNormal"><span style="font-family:"Rockwell","serif";color:#1F497D"> </span></p>
<p class="MsoNormal"><span style="font-family:"Rockwell","serif";color:#1F497D">Andrew</span></p></font></span></div></div></div></div></blockquote><div><br>numpy.floating would be the one for non-complex float types (and numpy.inexact the parent for both complex and non-complex). The class hierarchy is shown in the link I provided in my previous mail.<br>
<br>-=- Olivier<br></div></div>