by divbzero · 4y ago · 0 comments
Using @dataclass the example from OP would look like:
from dataclasses import dataclass
@dataclass
class Point3D:
x: float
y: float
z: float
[1]: https://docs.python.org/3/library/dataclasses.htmlThis article was correct and addressed a very real need in Python programming—for year 2016. By now it is obsolete and today's standard library module `dataclasses` does all of that and more.
Does the keyword-only feature in 3.10 help you at all?
I don't know much about attrs, only professionally coming to python since 3.7, but I'm not going to bring it in if there's something sufficient in the language