Ethan Furman wrote:
> On 7/9/22 12:19, Steve Jorgensen wrote:
> > [...] 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
> >
On 7/9/22 12:19, Steve Jorgensen wrote:
> [...] 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?
Do you
On 7/7/22 18:22, Steve Jorgensen wrote:
> 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
On 7/8/22 19:50, Ethan Furman wrote:
> 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.
Fixed in 3.11: ``
--
~Ethan~
On 7/7/22 09:01, Steve Jorgensen wrote:
> Actually, maybe these are fundamentally incompatible? `@dataclass` is a
decorator, so it
> acts on the class after it was already defined, but `Enum` acts before that
when `@dataclass`
> cannot have not generated the `__init__` yet. Right?
Correct.
On 7/6/22 17:01, 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
On Tue, 12 Jul 2022, 18:05 Steve Jorgensen, wrote:
> Chris Angelico wrote:
> > On Mon, 11 Jul 2022 at 03:54, Steve Jorgensen stevec...@gmail.com wrote:
> > > David Mertz, Ph.D. wrote:
> > > I've seen this thread, and also wondered why anyone could EVER want a
> > > dataclass that is an enum.
Chris Angelico wrote:
> On Mon, 11 Jul 2022 at 03:54, Steve Jorgensen stevec...@gmail.com wrote:
> > David Mertz, Ph.D. wrote:
> > I've seen this thread, and also wondered why anyone could EVER want a
> > dataclass that is an enum. Nothing I've seen in the thread gives me any
> > hint about that,
On Fri, 8 Jul 2022 at 02:22, Steve Jorgensen wrote:
> 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
On Mon, 11 Jul 2022 at 03:54, Steve Jorgensen wrote:
>
> David Mertz, Ph.D. wrote:
> > I've seen this thread, and also wondered why anyone could EVER want a
> > dataclass that is an enum. Nothing I've seen in the thread gives me any
> > hint about that, really.
> > On Sun, Jul 10, 2022 at 7:44
David Mertz, Ph.D. wrote:
> I've seen this thread, and also wondered why anyone could EVER want a
> dataclass that is an enum. Nothing I've seen in the thread gives me any
> hint about that, really.
> On Sun, Jul 10, 2022 at 7:44 AM Barry Scott ba...@barrys-emacs.org wrote:
> > On 9 Jul 2022, at
I've seen this thread, and also wondered why anyone could EVER want a
dataclass that is an enum. Nothing I've seen in the thread gives me any
hint about that, really.
On Sun, Jul 10, 2022 at 7:44 AM Barry Scott wrote:
>
>
> > On 9 Jul 2022, at 22:53, Steve Jorgensen wrote:
> >
> > I don't
> On 9 Jul 2022, at 22:53, Steve Jorgensen wrote:
>
> I don't think that dataclasses have the limited set of intended uses that you
> are interpreting them as having. To me, the fact that they can be frozen
> makes them a good fit with Enum.
Please quote the email that you are replying to.
I don't think that dataclasses have the limited set of intended uses that you
are interpreting them as having. To me, the fact that they can be frozen makes
them a good fit with Enum.
___
Python-ideas mailing list -- python-ideas@python.org
To
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
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
> On 8 Jul 2022, at 02:22, Steve Jorgensen wrote:
>
> 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
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
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.
19 matches
Mail list logo