title: Why does a built-in function class throw NameError when trying to reference it?
body: <p>I don't understand why when executing</p>
  <pre><code>def foo():
      pass
  
  print(type(foo))
  print(isinstance(foo, function))
  </code></pre>
  <p>The output is</p>
  <pre><code>&lt;class 'function'&gt;
  NameError: name 'function' is not defined
  </code></pre>
  <p>But when executing</p>
  <pre><code>foo = list()
  
  print(type(foo))
  print(isinstance(foo, list))
  </code></pre>
  <p>The output is</p>
  <pre><code>&lt;class 'list'&gt;
  True
  </code></pre>
  <p>Why does the first execution result in a <code>NameError</code> when <code>function</code> is clearly a valid class? Thanks in advance.</p>