This tool uses undataclass.py to demonstrate what dataclasses really do for us. Python's dataclass decorator gives us __init__, __repr__, and __eq__ methods and (depending on what options we send) much more as well!
Paste your dataclass below to see what happens.
Or play around:
remove frozen=True
,
add kw_only=True
,
add = field(repr=False, default=0)
to the last line,
or try something complex.
Curious how this works? Read how and why I used match-case while writing this and the full walk through of how this works.
Loading...