Ethan Furman wrote:
> On 7/7/22 09:01, Steve Jorgensen wrote:
> > Actually, maybe these are fundamentally incompatible?
> > Their intended use seems fundamentally incompatible:
> - dataclass was designed for making many mutable records (hundreds, 
> thousands, or more)
> - enum was designed to make a handful of named constants (I haven't yet seen 
> one with even a hundred elements)
> The repr from a combined dataclass/enum looks like a dataclass, giving no 
> clue that the object is an enum, and omitting 
> any information about which enum member it is and which enum it is from.
> Given these conflicts of interest, I don't see any dataclass examples making 
> it into the enum documentation.
> --
> ~Ethan~

Per my subsequent self-reply, they are only incompatible when trying to do them 
at the same time in the same class definition. It works great to combine them 
by defining the dataclass as a mixin for the Enum class. Why would it not be 
good to include that as an example in the official docs, assuming (as I 
believe) that it is a particularly useful combination?
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/VFGXT4QOWYF3UJVWYOR54GNTKEG2XT7D/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to