3 ms·
If you like this style of programming but use Python for your day-to-day, check out typeguard; it provides runtime assertions for parts of the Python type annot
by zbentley 4y ago
If you like this style of programming but use Python for your day-to-day, check out typeguard; it provides runtime assertions for parts of the Python type annotation system similar to "Invariant".
As with many tools, there are caveats. It's often surprisingly slow (so avoid using it on hot paths, or only turn it on during your testing/pre-production runs) and can't type-check everything (e.g. callables). But it's still pretty nice and requires minimal effort to use!
https://pypi.org/project/typeguard/ https://pypi.org/project/typeguard/