title: Do type annotations in Python enforce static type checking?
body: <p>I'm trying to enforce some static type checking in a project written in Python, using <code>typing</code> module.</p>
  <p>When I define a function like <a href="https://docs.python.org/3/library/typing.html" rel="nofollow noreferrer">the one from the doc</a></p>
  <pre><code>def greeting(name: str) -&gt; str:
      return 'Hello ' + name
  </code></pre>
  <p>and try to do something like <code>greeting(3)</code>, I indeed got the following error</p>
  <pre><code>Traceback (most recent call last):
    File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;
    File &quot;&lt;stdin&gt;&quot;, line 2, in greeting
  TypeError: must be str, not int
  </code></pre>
  <p>But when I again define a function called <code>test</code></p>
  <pre><code>def test(a: int) -&gt; None:
      print(a)
  </code></pre>
  <p>and do <code>test(&quot;a&quot;)</code>, I have <code>a</code> printed without any errors raised. I also tried</p>
  <pre><code>def test(a: str) -&gt; None:
      print(a)
  </code></pre>
  <p>and do <code>test(3)</code>, but no TypeError is raised.</p>
  <p>I defined both functions in exactly the same environment, i.e. an interaction python session using iTerm. Why would this happen?</p>