Hacker News new | ask | show | jobs
by clepto 639 days ago
I see a lot of people mentioning Pydantic here, but you should take a look into TypedDict. It provides a type structure ontop of a plain dictionary, and sounds like exactly what you’d want, and is a built-in that you don’t need a dependency for.

Mypy for example can also see the types of the dictionary are supposed to be when you use it just like a normal dictionary.