Static Type Checking with MyPy

This Tuesday saw the 23rd gathering of the the PizzaPY Pythonistas in Cebu City, Philippines. The topic was “Static type-checking with MyPy”, which I presented.

The presentation and the demo files are on GitHub. All you need is a UNIX, Docker and Git—the rest Docker and Bash scripts do for you. Just start playing with MyPy! :)

Major learnings:

  • I like expressing the tradeoff of adding types as: better understandable, less readable
  • I learnt to appreciate the different ways you can add static types annotations to a historically unchecked language.
    • Comments, backwards compatible, but not integrated
    • Stub files, with the ups and downs of not cluttering the code
    • Extending the language (the parser at least) to ignore type annotations, with the obvious issues of minimum versions and complexity growth
  • Docker greatly simplifies providing the audience of meetups with specific throw-away environments for meetups.