The dataclass module is very useful. It enables a user to create a class without having to go through the standard lengthy process. In particular it creates the special methods __init__() and __repr__() for the user, which is very convenient especially when there is a need for many classes.
In addition to the __init__() and __repr__() methods, the dataclass also provides for other special methods. We can see the docs here: https://docs.python.org/3/library/dataclasses.html.
Here is a nice example of the usage:
from dataclasses import dataclass
@dataclass
class InsideBits:
''' these are the inner bits '''
left_inner: int
right_inner: int
@dataclass
class OutsideBits:
''' the outside bits reference the inside bits '''
left_outer: InsideBits
right_outer: InsideBits
p = InsideBits(1,2)
q = InsideBits(3,4)
x = OutsideBits(p, q)
print(x)
print(x.left_outer)
print(x.left_outer.left_inner)