← ALL FIELD NOTES

LOG 011 · TECHNICAL · 2022-12-06

Robust Python - the book that sold me on type hints

1 min read

This one converted me. I’d been using type hints a little bit before but now I’m convinced that they are worth it for larger projects. Easy 5/5.

The book is well-written and easy to read, with clear examples that helped me understand the concepts being discussed. The thing I appreciated most is how it made it clear that using type hints is the way to go. Viafore provides a compelling case for why type hints matter and shows how to use them effectively in Python.

And it stuck. I rolled type hints out across real projects afterwards, and years later I still type everything. These days I use the type checker ty instead of mypy because it’s much faster. Typing has helped so much, especially with AI catching so many bugs.

The other standout was the testing material. Beyond the basics of unit testing and integration testing, the book covers more advanced techniques like mutation testing, which I’d never been introduced to before. It gives practical advice and specific libraries for implementing these tests in Python. I’ll be honest though, I never actually tried mutation testing. It seemed over the top for my work. If I ever need to write something truly mission critical, I might give it a go.

Who’s it for? If you’re already using typing properly in your projects, there’s maybe no point. Otherwise, anyone would benefit. Whether you’re a beginner or an experienced programmer, this book has some great tips.