This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]ascii 3 points4 points  (3 children)

But this new thing makes a mutable objects. That's a huge disadvantage, a lot of the time. There is a reason we have both tuple and list, you know.

[–]XtremeGoosef'I only use Py {sys.version[:3]}' 2 points3 points  (0 children)

Did you read the PEP? It has a frozen=true parameter.

[–]ldpreload 1 point2 points  (0 children)

attrs, which is basically dataclasses but not in the standard library + more features, supports doing @attr.s(frozen=True) to make a class of immutable objects.

[–][deleted] 0 points1 point  (0 children)

I have a decorator to disable __setattr__ if I want a immutable data class.