Hacker News new | ask | show | jobs
by skeledrew 612 days ago
I tried using it, but beartype quickly became a pain with having to decorate things manually. Then I found typeguard which goes even further and never looked back. Instead of manually decorating each individual function, an import hook can be activated that automatically decorates any function with type annotation. Massive QoL improvement. I have it set to only activate during testing though as I'm unsure of the overhead.
1 comments

It looks like beartype supports the same sort of implicit decoration, because there's mention of an explicit API:

>Beartype now implicitly type-checks all annotated classes, callables, and variable assignments across all submodules of all packages.

That definitely got implemented after I had already moved on.
Iirc beartype is several orders of magnitude faster than typeguard so you might want to give it a try again