4 ms·
Since python 3.7, dataclass is probably preferred over namedtuple, which is typed, https://realpython.com/python-data-classes/ https://realpython.com/python-dat
by jquast 7y ago
Since python 3.7, dataclass is probably preferred over namedtuple, which is typed, https://realpython.com/python-data-classes/ https://realpython.com/python-data-classes/
- faizshah 7y agoDataclass is not immutable, for some cases typing.namedtuple should be preferred over dataclass if typing is needed. Deep dive here: https://stackoverflow.com/questions/51671699/data-classes-vs-typing-namedtuple-primary-use-cases https://stackoverflow.com/questions/51671699/data-classes-vs...
- tasubotadas 7y agoThat's not really true - you can set frozen=True and you will get an immutable version of the class.
- EamonnMR 7y agoWe've had great results with Pydantic models. https://pydantic-docs.helpmanual.io/ https://pydantic-docs.helpmanual.io/