title: Does mypy only type check a function if it declares a return type?
body: <p>The following file: </p>
  
  <pre><code>from typing import List
  
  class A:
  
  def __init__(self, myStr):
      self.chars: List[int] = list(myStr)
  
  def toString(self):
      return "".join(self.chars)
  </code></pre>
  
  <p>typechecks (note chars should be List[str] not List[int]): <code>➜  Python python3 -m mypy temp.py =&gt; Success: no issues found in 1 source file</code>, but the following one, where I declare the return type of toString, does: </p>
  
  <pre><code>from typing import List
  
  class A:
  
  def __init__(self, myStr):
      self.chars: List[int] = list(myStr)
  
  def toString(self) -&gt; str:
      return "".join(self.chars)
  
  ➜  Python python3 -m mypy temp.py
  temp.py:9: error: Argument 1 to "join" of "str" has incompatible type "List[int]"; expected "Iterable[str]"
  Found 1 error in 1 file (checked 1 source file)
  </code></pre>
  
  <p>Could anyone explain mypy's behaviour in this case? Why do I need to add the return type to the function to force mypy to correctly diagnose the problem? (it already has all necessary information: that chars is List[int] and join accepts Iterable[str])</p>