Classes in Python

Classes in Python: Classes: Blueprints for Your Own Things, Dataclasses: Classes That Hold Data.

Updated

  1. Classes: Blueprints for Your Own Things (Apprentice): A class describes one kind of thing your program keeps track of, what it holds and what it can do, so every object made from it gets the same attributes, the same methods and a friendly printout.
  2. Dataclasses: Classes That Hold Data (Journeyman): The @dataclass decorator writes a data-holding class's __init__, __repr__ and == for you from a list of fields with types, with defaults for the fields a call can leave out and default_factory for a fresh list in every object.