Contribute Media
A thank you to everyone who makes this possible: Read More

Static typing: beyond the basics of def foo(x: int) -> str:


The Python community has been warming up to static typing for a few years now. You may have seen talks that did a great job of introducing the basic concepts, mypy, and high-level strategies to cover existing code bases.

We need to go deeper.

Let’s talk about the challenges you inevitably encounter when you try to type- check a large code base. One full of many moving parts, complex architectures, metaprogramming tricks, and interfaces with a dozen other packages.

Static type checking is very powerful – when you use it to maximum advantage and explain your code to the typechecker accurately. We will cover a few tools at your disposal: generics, signature overloads, protocols, custom mypy plug- ins, and more.

There is more than just tools, though. Behind them all are universal concepts valid in any language. I hope to convince you that thinking in terms of the type system helps you write better code…


Improve this page