On Mon, Dec 13, 2021 at 06:43:27AM -0000, Vioshim wrote: > Anyways, at the moment that I write this message in python3.10.1, It > happens that when making a class with the dataclasses module, this > class can't actually be used in Multiple inheritance for Enum > purposes, this is mostly to avoid code repetition by having to write > the methods over again. [...] > class Entries(Foo, Enum): > ENTRY1 = Foo(1) > ENTRY2 = Foo(2) > ENTRY3 = Foo(3)
I think this may be what you are looking for: >>> class Entries(Foo, Enum): ... ENTRY1 = 1 ... ENTRY2 = 2 ... >>> Entries.ENTRY1 Entries(a=1) >>> Entries.ENTRY1.a 1 >>> isinstance(Entries.ENTRY2, Foo) True -- Steve _______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/UTNUZZUHTAXMEDJDZMTAWO6ZYXUBQD7G/ Code of Conduct: http://python.org/psf/codeofconduct/