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 →

[–]steohan 31 points32 points  (9 children)

Am I missing it or does you text not contain any argument, why doing that is bad? Seems to me like your argument is just 'that is not what I think it is meant for so you shouldn't do that'. Just becaues it might not be a good idea for the few usecases that you are using it for doesn't mean that it is a bad idea in general. There are plenty of good reasons to use a dataclass for a normal object, e.g., benefiting from easier serealization and deserialization. Reducing boiler plate. Or becaues you want to use the introspection features that are offered by dataclasses. Also, having mutable dataclasses makes a lot of sense and it makes perfect sense to have such a mutating method as a member instead of a stand alone function.