[Python-Dev] Enum: subclassing?
Ethan Furman
ethan at stoneleaf.us
Thu May 2 00:51:44 CEST 2013
On 05/01/2013 02:07 PM, Guido van Rossum wrote:
> On Wed, May 1, 2013 at 2:04 PM, Eli Bendersky <eliben at gmail.com> wrote:
>>
>> class BehaviorMixin:
>> # bla bla
>>
>> class MyBehavingIntEnum(int, BehaviorMixin, Enum):
>> foo = 1
>> bar = 2
>
> It's a common pattern to do this with a base class rather than a
> mixin, though, and I think the rule "only allow subclassing empty
> enums" makes a lot of sense.
So is this a pronouncement? I'm going to get whiplash if I change that bit of code many more times. ;)
--
~Ethan~
More information about the Python-Dev
mailing list