How To Efficiently Validate Input Types in Python Functions

Decorators to the rescue

Matt Sosna
Better Programming
Published in
5 min readApr 20, 2021

--

Typing on old keyboard
Photo by Denise Jans on Unsplash.

When it comes to writing complex pipelines running in production, it’s critical to have a clear understanding of what each function does and how its outputs affect downstream functions. But despite our best efforts to write modular, well-tested functions, bugs love hiding in the handoffs between functions — and they can be…

--

--

Sr ML Engineer @ Meta. Princeton PhD. Dad. Write about data science, machine learning, statistics, Python. Addicted to learning how things work. Views my own.