2 ms·
Yes, and dataclasses offer an even nicer notation.
by HelloNurse 4y ago
Yes, and dataclasses offer an even nicer notation.
- kzrdude 4y agoDataclasses make it very easy to define such classes indeed but they don't disallow extra attributes. So they really compose with a lot of other techniques
- packetlost 4y agoI'm not sure what you mean here, GP was saying dataclasses themselves don't prevent rogue assignments, but they have a nicer syntax for generating a `__slots__` automatically based on type-hints/class attributes which absolutely does.
- kzrdude 4y agoI see, new in Py 3.10 and new to me