Comment on Python classes aren’t always the best solutionparentComments−ozkatz1yI agree dataclasses are a better alternative when you want a class that represents data :)There are typed dicts where you specify field names and the respective key typesThe only way to achieve this that I'm aware of is PEP 589: subclassing TypedDict. Which I believe negates the argument in the post.−Arch-TK1yI don't think using TypedDict to create a type hint is against the spirit of the post.Although reading a lot of what has been written here, it seems people aren't really getting the spirit of the post in the first place.
Comments
I agree dataclasses are a better alternative when you want a class that represents data :)
The only way to achieve this that I'm aware of is PEP 589: subclassing TypedDict. Which I believe negates the argument in the post.
I don't think using TypedDict to create a type hint is against the spirit of the post.
Although reading a lot of what has been written here, it seems people aren't really getting the spirit of the post in the first place.