Source of screenshot::
You Are Going To Like These New Features In Python 3.11
Time signature:: 6:35
First, love this data class::

- Decorated at the class level.
- Then I’m not sure what the class method decorator for the from_fen method means. Still, I love that there appears a distinction between the class method decorator and the passing of self in the following promote_to_queen function, which is also a class method it looks like that class method decorator has some superpower. I must find out what it is?
Source for this next section on Data Classes and specifically their use with an ORM::
Using Data Classes to create database models in Python
Data classes have been around since Python 3.7
- Here is an example of a data class definition::
from dataclasses import dataclass, field
@dataclass
class Point:
x: int
y: int
z: int = field(default=0)
- Note that data classes are not intended to be used with complex classes that include behavior, like methods, only to store data.
Using Data Classes in Python – Real Python
Using Data Classes in Python