Python - dataclass decorator
As the Real Python article [Data Classes in Python 3.7+ (Guide)][3] says:
One new and exciting feature coming in Python 3.7 is the data class. A data class is a class typically containing mainly data, although there aren’t really any restrictions. It is created using the new @dataclass decorator, as follows:
from dataclasses import dataclass
@dataclass
class DataClassCard:
rank: str
suit: str
A data class comes with basic functionality already implemented. For instance, you can instantiate, print, and compare data class instances straight out of the box ...
It has (as they usually do) a great explanation of what and how to use it. Very informative. Probably what I would use initially.
Python dataclass decorator tutorial is a nice tutorial as well. It doesn't explain as much as show, but that is good too.
This is something that I should probably use more of!
[3]: https://realpython.com/python-data-classes/ [3]: "Data Classes in Python 3.7+ (Guide)"