Get the latest tech news
Baby's first type checker
Let's build a Python type checker in 300 lines of code.
We need to parse the annotations, infer literals, support indexing, extend the compatibility check, and add our classes to represent lists and dictionaries. Once again the parsing aspect isn't particularly interesting, it just involves understanding how Python builds the AST so you can capture the information correctly for all cases. I hope this article showed that type checking is fairly simple, even in a language as large as Python, although there are many scenarios that you must cover.
Or read this on Hacker News