Currently, in the Pydantic section, the example defines a string-based enum as:
from enum import Enum
class MusicBand(str, Enum):
AEROSMITH = "AEROSMITH"
QUEEN = "QUEEN"
ACDC = "AC/DC"
A better approach in Python 3.11+ is to use StrEnum, which avoids the need for multiple inheritance (str, Enum) and makes the intent clearer:
from enum import StrEnum
class MusicBand(StrEnum):
AEROSMITH = "AEROSMITH"
QUEEN = "QUEEN"
ACDC = "AC/DC"