The decorator returns the same class that it is called on no new If any of the added methods alreadyĮxist in the class, the behavior depends on the parameter, as documentedīelow. The dataclass() decorator will add various “dunder” methods to Order in which they appear in the class definition. The order of the fields in all of the generated methods is the A field is defined as a class variable that has aĮxceptions described below, nothing in dataclass()Įxamines the type specified in the variable annotation. The dataclass() decorator examines the class to findįields. Special methods to classes, as described below. This function is a decorator that is used to add generated dataclass ( *, init = True, repr = True, eq = True, order = False, unsafe_hash = False, frozen = False, match_args = True, kw_only = False, slots = False, weakref_slot = False ) ¶