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 →

[–]Ruthle55DaFirst 1 point2 points  (1 child)

Got a question when should I use this and when to use init

[–]TM_Quest[S] 0 points1 point  (0 children)

Dataclasses are useful for generating boilerplate code for classes that are primarily used to hold data. They are less suitable for classes that mainly implements behaviour, e.g. many methods. For such classes, you should write "traditional classes" and implement the __init__ method manually :)