title: Difference between int and numbers.Integral in Python
body: <p>I'm trying to get a deeper understanding in Python's data model and I don't fully understand the following code:</p>
  
  <pre><code>&gt;&gt;&gt; x = 1
  
  &gt;&gt;&gt; isinstance(x,int)
  True
  
  &gt;&gt;&gt; isinstance(x,numbers.Integral)
  True
  
  &gt;&gt;&gt; inspect.getmro(int)
  (&lt;type 'int'&gt;, &lt;type 'object'&gt;)
  
  &gt;&gt;&gt; inspect.getmro(numbers.Integral)
  (&lt;class 'numbers.Integral'&gt;, &lt;class 'numbers.Rational'&gt;, &lt;class 'numbers.Real'&gt;,
   &lt;class 'numbers.Complex'&gt;, &lt;class 'numbers.Number'&gt;, &lt;type 'object'&gt;)
  </code></pre>
  
  <p>Based on the above, it seems that <code>int</code> and <code>number.Integral</code> are not in the same hierarchy.</p>
  
  <p>From the Python reference (2.6.6) I see</p>
  
  <blockquote>
    <p>numbers.Integral - These represent elements from the mathematical set of integers (positive and negative).</p>
  </blockquote>
  
  <p>What's the difference between <code>int</code> and <code>numbers.Integral</code>? Does it have something to do with the <code>type int</code> vs <code>class numbers.Integral</code> I see in the above output?</p>