On 5/8/2022 5:01 PM, David Hagen wrote:
I am sympathetic to this design. Right now, `Enum` rewrites that `"quit"` value so that `Message.QUIT` is not actually equal to `"quit"`, but is actually an instance of `Message`. If the syntax of `Enum` was expanded to allow not just values, but classes, then `Move`, `Write`, and `ChangeColor` would have to be rebuilt to be subclasses of `Message`. I am not sure what all the implications of that would be. I remember there was hesitation toward having dataclasses add `__slots__` because it required rebuilding each class from scratch [1], but that was ultimately resolved in favor of rebuilding [2]. I have not heard any horror stories about dataclass slots, so maybe it's ok.
There are definitely some problems with returning a new class for slots=True. For example, zero-argument super is broken: https://github.com/python/cpython/issues/90562 I'm sure there are others. Eric