Additional notes

  • You should include types for arguments with default values in theannotation. The opt argument of method in the example at thebeginning of this section is an example of this.
  • The annotation can be on the same line as the function header or onthe following line.
  • Variables use a comment-based type syntax (explained inExplicit types for variables).
  • You don’t need to use string literal escapes for forward referenceswithin comments (string literal escapes are explained later).
  • Mypy uses a separate set of library stub files in typeshed for Python 2. Library supportmay vary between Python 2 and Python 3.