[Python-ideas] Re: Make dataclass aware that it might be used with Enum

2022-07-07 Thread Steve Jorgensen
Steve Jorgensen wrote: > Perhaps, this has already been addressed in a newer release (?) but in Python > 3.9, making `@dataclass` work with `Enum` is a bit awkward. > Currently, it order to make it work, I have to: > 1. Pass `init=False` to `@dataclass` and hand-write the `__init__` method > 2. Pa

[Python-ideas] Re: Make dataclass aware that it might be used with Enum

2022-07-07 Thread Steve Jorgensen
After some playing around, I figured out a pattern that works without any changes to the implementations of `dataclass` or `Enum`, and I like this because it keeps the 2 kinds of concern separate. Maybe I'll try submitting an MR to add an example like this to the documentation for `Enum`. In [1