Python is a great language for writing software because it’s expressive, concise, and clear. But as a codebase grows large, Python can get harder to understand than comparable Java, Go, or Haskell. The author of almost every piece of code has expectations about what types the values involved will have, and a reader has to form the same expectations — but in Python these expectations are usually left implicit, and the readers to fend for themselves.
I’ll describe recent developments that enable Python users to make these type expectations — aka “static types” — explicit. A new standard, PEP 484, provides notation for writing down types, and a type-checker, Mypy, analyzes the program to confirm that it really abides by the expectations the authors have written down. Dropbox is supporting the work and its engineers eagerly beginning to adopt it in the company’s 3-million-line Python codebase. Everything is 100% open source and applies to both Python 3 and Python 2. More users, bug reports, and patches are all welcome.
(Given at the Recurse Center on 2016-05-09.)