Login
Roast topics
Find topics
Find it!
From:
ricardoanderegg.com
(Uncensored)
subscribe
Validate Python dataclass types - rand[om]
https://ricardoanderegg.com/posts/python-validate-dataclass-types/
links
backlinks
Roast topics
Find topics
Roast it!
In Python you can create dataclasses with the wrong type. The type checker should show an error, but nothing prevents creating the object. This small function validates that each attribute is of the …