
Steve, It looks like what you're trying to achieve is an Enum with more than a singleton `.value` exposed on each sub-item. I was able to achieve something that *looks* like your example using an Enum mixin with a custom class:
from enum import Enum class Labeler: @property def label(self): return self.name.capitalize()
class Size(Labeler, Enum): SMALL = "S" MEDIUM = "M" LARGE = "L" Size.LARGE.label 'Large' Size.LARGE.value 'L' More custom values could be added by expanding `Labeler`. FWIW, I also got a mixin with namedtuple to work:
from collections import namedtuple as nt Key = nt('Key', ('label', 'value')) class Foo(Key, Enum) Bar = Key(label='Cat', value=5) Baz = Key(label='Dog', value=10)
Foo.Bar.label 'Cat' These both were with Python 3.7. -Brian