title: Difference between Python type hints of type and Type?
body: <p>Today, I came across a function type hinted with <code>type</code>.</p>
  <p>I have done some research as to when one should type hint with <code>type</code> or <code>Type</code>, and I can't find a satisfactory answer.  From my research it seems there's some overlap between the two.</p>
  <p>My question:</p>
  <ul>
  <li>What is the difference between <code>type</code> and <code>Type</code>?</li>
  <li>What is an example use case that shows when to use <code>type</code> vs <code>Type</code>?</li>
  </ul>
  <hr />
  <p><strong>Research</strong></p>
  <p>Looking at the source for <a href="https://github.com/python/typing/blob/3.7.4.3/src/typing.py#L2096" rel="nofollow noreferrer"><code>Type</code> (from <code>typing</code> tag <code>3.7.4.3</code>)</a>, I can see this:</p>
  <blockquote>
  <pre class="lang-py prettyprint-override"><code># Internal type variable used for Type[].
  CT_co = TypeVar('CT_co', covariant=True, bound=type)
  
  
  # This is not a real generic class.  Don't use outside annotations. 
  class Type(Generic[CT_co], extra=type):
      &quot;&quot;&quot;A special construct usable to annotate class objects. ```
  </code></pre>
  </blockquote>
  <p>It looks like <code>Type</code> may just be an alias for <code>type</code>, except it supports <code>Generic</code> parameterization.  Is this correct?</p>
  <hr />
  <p><strong>Example</strong></p>
  <p>Here is some sample code made using <code>Python==3.8.5</code> and <code>mypy==0.782</code>:</p>
  <pre class="lang-py prettyprint-override"><code>from typing import Type
  
  def foo(val: type) -&gt; None:
      reveal_type(val)  # mypy output: Revealed type is 'builtins.type'
  
  def bar(val: Type) -&gt; None:
      reveal_type(val)  # mypy output: Revealed type is 'Type[Any]'
  
  class Baz:
      pass
  
  foo(type(bool))
  foo(Baz)
  foo(Baz())  # error: Argument 1 to &quot;foo&quot; has incompatible type &quot;Baz&quot;; expected &quot;type&quot;
  bar(type(bool))
  bar(Baz)
  bar(Baz())  # error: Argument 1 to &quot;bar&quot; has incompatible type &quot;Baz&quot;; expected &quot;Type[Any]&quot;
  </code></pre>
  <p>Clearly <code>mypy</code> recognizes a difference.</p>