Python — From Basics to Advanced · OOP — Object-Oriented Programming
Dataclasses and Object Factories
OOP — Object-Oriented Programming
Introduction
Dataclasses are the modern way to create data-holding classes - @dataclass automatically generates __init__, __repr__ and __eq__. In this lesson you also learn alternative constructors (object factories) using @classmethod, and the difference between @classmethod and @staticmethod.