title: None Python error/bug?
body: <p>In Python you have the <code>None</code> singleton, which acts pretty oddly in certain circumstances:</p>
  
  <pre><code>&gt;&gt;&gt; a = None
  &gt;&gt;&gt; type(a)
  &lt;type 'NoneType'&gt;
  &gt;&gt;&gt; isinstance(a,None)
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  TypeError: isinstance() arg 2 must be a class, type, or tuple of classes and types
  </code></pre>
  
  <p>So first off, <code>&lt;type 'NoneType'&gt;</code> displays that <code>None</code> is not a type, but that <code>NoneType</code> is. Yet when you run <code>isinstance(a,NoneType)</code>, it responds with an error: <code>NameError: name 'NoneType' is not defined</code></p>
  
  <p>Now, given this, if you have a function with an input default set to <code>None</code>, and need to check, you would do the following:</p>
  
  <pre><code>if variable is None:
      #do something
  else:
      #do something
  </code></pre>
  
  <p>what is the reason that I cannot do the following instead:</p>
  
  <pre><code>if isinstance(variable,None): #or NoneType
      #do something
  else:
      #do something
  </code></pre>
  
  <p><strong>I am just looking for a detailed explanation so I can better understand this</strong></p>
  
  <p>Edit: good application</p>
  
  <p>Lets say I wanted to use <code>isinstance</code> so that I can do something if <code>variable</code> is a variety of types, including <code>None</code>:</p>
  
  <pre><code>if isinstance(variable,(None,str,float)):
      #do something
  </code></pre>