Python Boolean comparison
<p>I'm testing Python's Boolean expressions. When I run the following code:</p>

<pre><code>x = 3
print type(x)
print (x is int)
print (x is not int)
</code></pre>

<p>I get the following results:</p>

<pre><code>&lt;type 'int'&gt;
False
True
</code></pre>

<p>Why is (x is int) returning false and (x is not int) returning true when clearly x is an integer type?</p>

<p>The best way to do this is use <code>isinstance()</code></p>

<p>so in your case:</p>

<pre><code>x = 3
print isinstance(x, int)
</code></pre>

<p>Regarding python <code>is</code></p>

<blockquote>
  <p>The operators <code>is</code> and <code>is not</code> test for object identity: x is y is true
  if and only if x and y are the same object.</p>
</blockquote>

<p>Taken from <a href="https://docs.python.org/2/reference/expressions.html#not-in" rel="nofollow">docs</a></p>

python boolean boolean-logic boolean-expression