Y
Hacker News
new
|
ask
|
show
|
jobs
by
BerislavLopac
2732 days ago
Or even more by attrs:
https://www.attrs.org/en/stable/
1 comments
_fbpt
2731 days ago
Try @attr.dataclass. It uses the cleaner 3.6+ dataclass syntax, but is more flexible (supports kw-only classes).
link
thedigicat
2729 days ago
Thank you both for your suggestions, I will consider using one of these in the next versions of the book. Python is a moving target, so I will have to update the examples.
link
MrSaints
2720 days ago
I've recently also come across
https://pydantic-docs.helpmanual.io/
which appears to be useful for enforcing simple constraints on domain entities.
link