Is there any difference except the writing __init__
method between data class and class (Python)?
Asked
Active
Viewed 45 times
1

Barmar
- 741,623
- 53
- 500
- 612

Sviatoslav Kalina
- 27
- 3
-
`class` is a general mechanism for defining your own classes. `@dataclass` is a decorator that you use with your classes to automatically define some standard methods. – Barmar Jun 06 '22 at 22:44
-
See https://docs.python.org/3/library/dataclasses.html for the full list of what `@dataclass` does. – Barmar Jun 06 '22 at 22:45