I'm making a dataclass with a field for which I'd like there to only be a few possible values. I was thinking something like this:
@dataclass
class Person:
name: str = field(default='Eric', choices=['Eric', 'John', 'Graham', 'Terry'])
I know that one solution is to validate arguments in the __post_init__ method but is there a cleaner way using something like the syntax above?