<p dir="auto">Hello,</p>
<p dir="auto">I have trouble in comparing dtype of np.int32 array.<br>
The power of np.int32 ndarray has dtype of np.int32 which seems different from <em>proper np.int32</em>.</p>
<p dir="auto">Example:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="Jupyter QtConsole 4.3.1
Python 3.6.3 |Anaconda custom (64-bit)| (default, Nov  8 2017, 15:10:56) [MSC v.1900 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 6.1.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import numpy as np
In [2]: np.__version__
Out[2]: '1.13.3'

In [3]: arr1 = np.arange(10)
In [4]: arr2 = np.arange(10)**2
In [5]: arr1.dtype.type
Out[5]: numpy.int32

In [6]: arr2.dtype.type
Out[6]: numpy.int32

In [7]: arr1.dtype.type == arr2.dtype.type
Out[7]: False

In [8]: arr1.dtype.type is arr2.dtype.type
Out[8]: False

In [9]: arr2.dtype.type == np.int32
Out[9]: False"><pre class="notranslate"><span class="pl-v">Jupyter</span> <span class="pl-v">QtConsole</span> <span class="pl-c1">4.3</span><span class="pl-c1">.1</span>
<span class="pl-v">Python</span> <span class="pl-c1">3.6</span><span class="pl-c1">.3</span> <span class="pl-c1">|</span><span class="pl-v">Anaconda</span> <span class="pl-s1">custom</span> (<span class="pl-c1">64</span><span class="pl-c1">-</span><span class="pl-s1">bit</span>)<span class="pl-c1">|</span> (<span class="pl-s1">default</span>, <span class="pl-v">Nov</span>  <span class="pl-c1">8</span> <span class="pl-c1">2017</span>, <span class="pl-c1">15</span>:<span class="pl-c1">10</span>:<span class="pl-c1">56</span>) [<span class="pl-v">MSC</span> <span class="pl-s1">v</span><span class="pl-c1">.1900</span> <span class="pl-c1">64</span> <span class="pl-en">bit</span> (<span class="pl-v">AMD64</span>)]
<span class="pl-v">Type</span> <span class="pl-s">'copyright'</span>, <span class="pl-s">'credits'</span> <span class="pl-c1">or</span> <span class="pl-s">'license'</span> <span class="pl-k">for</span> <span class="pl-s1">more</span> <span class="pl-s1">information</span>
<span class="pl-v">IPython</span> <span class="pl-c1">6.1</span><span class="pl-c1">.0</span> <span class="pl-c1">-</span><span class="pl-c1">-</span> <span class="pl-v">An</span> <span class="pl-s1">enhanced</span> <span class="pl-v">Interactive</span> <span class="pl-v">Python</span>. <span class="pl-v">Type</span> <span class="pl-s">'?'</span> <span class="pl-k">for</span> <span class="pl-s1">help</span>.

<span class="pl-v">In</span> [<span class="pl-c1">1</span>]: <span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-v">In</span> [<span class="pl-c1">2</span>]: <span class="pl-s1">np</span>.<span class="pl-s1">__version__</span>
<span class="pl-v">Out</span>[<span class="pl-c1">2</span>]: <span class="pl-s">'1.13.3'</span>

<span class="pl-v">In</span> [<span class="pl-c1">3</span>]: <span class="pl-s1">arr1</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">10</span>)
<span class="pl-v">In</span> [<span class="pl-c1">4</span>]: <span class="pl-s1">arr2</span> <span class="pl-c1">=</span> <span class="pl-s1">np</span>.<span class="pl-en">arange</span>(<span class="pl-c1">10</span>)<span class="pl-c1">**</span><span class="pl-c1">2</span>
<span class="pl-v">In</span> [<span class="pl-c1">5</span>]: <span class="pl-s1">arr1</span>.<span class="pl-s1">dtype</span>.<span class="pl-s1">type</span>
<span class="pl-v">Out</span>[<span class="pl-c1">5</span>]: <span class="pl-s1">numpy</span>.<span class="pl-s1">int32</span>

<span class="pl-v">In</span> [<span class="pl-c1">6</span>]: <span class="pl-s1">arr2</span>.<span class="pl-s1">dtype</span>.<span class="pl-s1">type</span>
<span class="pl-v">Out</span>[<span class="pl-c1">6</span>]: <span class="pl-s1">numpy</span>.<span class="pl-s1">int32</span>

<span class="pl-v">In</span> [<span class="pl-c1">7</span>]: <span class="pl-s1">arr1</span>.<span class="pl-s1">dtype</span>.<span class="pl-s1">type</span> <span class="pl-c1">==</span> <span class="pl-s1">arr2</span>.<span class="pl-s1">dtype</span>.<span class="pl-s1">type</span>
<span class="pl-v">Out</span>[<span class="pl-c1">7</span>]: <span class="pl-c1">False</span>

<span class="pl-v">In</span> [<span class="pl-c1">8</span>]: <span class="pl-s1">arr1</span>.<span class="pl-s1">dtype</span>.<span class="pl-s1">type</span> <span class="pl-c1">is</span> <span class="pl-s1">arr2</span>.<span class="pl-s1">dtype</span>.<span class="pl-s1">type</span>
<span class="pl-v">Out</span>[<span class="pl-c1">8</span>]: <span class="pl-c1">False</span>

<span class="pl-v">In</span> [<span class="pl-c1">9</span>]: <span class="pl-s1">arr2</span>.<span class="pl-s1">dtype</span>.<span class="pl-s1">type</span> <span class="pl-c1">==</span> <span class="pl-s1">np</span>.<span class="pl-s1">int32</span>
<span class="pl-v">Out</span>[<span class="pl-c1">9</span>]: <span class="pl-c1">False</span></pre></div>
<p dir="auto">I am using Anaconda version of numpy 1.13.3 with Python 3.6.3 on 64 bit Windows 7.</p>
<p dir="auto">On windows 7:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; np.cint, np.cint is np.int32
(numpy.int32, False)
&gt;&gt;&gt; np.int_, np.int_ is np.int32
(numpy.int32, True)"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">np</span>.<span class="pl-s1">cint</span>, <span class="pl-s1">np</span>.<span class="pl-s1">cint</span> <span class="pl-c1">is</span> <span class="pl-s1">np</span>.<span class="pl-s1">int32</span>
(<span class="pl-s1">numpy</span>.<span class="pl-s1">int32</span>, <span class="pl-c1">False</span>)
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">np</span>.<span class="pl-s1">int_</span>, <span class="pl-s1">np</span>.<span class="pl-s1">int_</span> <span class="pl-c1">is</span> <span class="pl-s1">np</span>.<span class="pl-s1">int32</span>
(<span class="pl-s1">numpy</span>.<span class="pl-s1">int32</span>, <span class="pl-c1">True</span>)</pre></div>
<p dir="auto">On 64-bit linux:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; np.int_, np.int_ is np.int64
(numpy.int64, True)
&gt;&gt;&gt; np.longlong, np.longlong is np.int64
(numpy.int64, False)"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">np</span>.<span class="pl-s1">int_</span>, <span class="pl-s1">np</span>.<span class="pl-s1">int_</span> <span class="pl-c1">is</span> <span class="pl-s1">np</span>.<span class="pl-s1">int64</span>
(<span class="pl-s1">numpy</span>.<span class="pl-s1">int64</span>, <span class="pl-c1">True</span>)
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">np</span>.<span class="pl-s1">longlong</span>, <span class="pl-s1">np</span>.<span class="pl-s1">longlong</span> <span class="pl-c1">is</span> <span class="pl-s1">np</span>.<span class="pl-s1">int64</span>
(<span class="pl-s1">numpy</span>.<span class="pl-s1">int64</span>, <span class="pl-c1">False</span>)</pre></div>
<hr>
<p dir="auto">(original title: <code class="notranslate">intc</code> displays wrong class name)</p>
<p dir="auto">The string representation of <code class="notranslate">numpy.intc</code> is <code class="notranslate">&lt;class 'numpy.int32'&gt;</code>. This would fine if this were true--just a name pointing to the same object. But at least on Windows 7, <code class="notranslate">numpy.intc</code> is not the same object as <code class="notranslate">numpy.int32</code>; it's not even a subclass. This is very confusing for debugging objects of this type, as objects inexplicably fail an <code class="notranslate">isinstance</code> test.</p>
<p dir="auto">Could one of these two small changes be made:</p>
<ul dir="auto">
<li>Either make <code class="notranslate">intc</code> just be another name pointing to the object behind <code class="notranslate">int32</code></li>
<li>Or make <code class="notranslate">intc</code> print out <code class="notranslate">&lt;class 'numpy.intc'&gt;</code></li>
</ul>