title: Python type hinting - how to hint optional argument whose default is not None?
body: <p>I am trying to implement PEP-484 in my Python 3 code for practice. While working on the following practice question, which looks like:</p>
  
  <pre><code>def fetch_n(what: str, n="all") -&gt; List[obj]:
      query = "some sql string"
      if n == "all":
          # do the fetching
      elif isinstance(n, int):
          query = query + " LIMIT ?"
          # do the fetching
      else:
          raise ValueError
  </code></pre>
  
  <p>Is it possible to hint <code>n</code> in the function definition to be -- <code>const str or int</code>? If yes, how to do it?</p>
  
  <p>I read the <a href="http://mypy.readthedocs.io/en/latest/cheat_sheet_py3.html" rel="nofollow noreferrer">cheat-sheet</a> and currently I am using <code>from typing import Optional</code> and <code>n: Optional[int]</code> but its not working as desired. </p>