|
|
|
|
|
by michaelmcmillan
2917 days ago
|
|
Love data classes! Would've been even cooler if they could've been made immutable. Oops, never mind: "It is not possible to create truly immutable Python objects. However, by passing frozen=True to the dataclass() decorator you can emulate immutability. In that case, dataclasses will add __setattr__() and __delattr__() methods to the class. These methods will raise a FrozenInstanceError when invoked." |
|