[Python-Dev] Enum: subclassing? (original) (raw)

Guido van Rossum guido at python.org
Thu May 2 02:11:32 CEST 2013


Yes.

On Wed, May 1, 2013 at 3:51 PM, Ethan Furman <ethan at stoneleaf.us> wrote:

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


Python-Dev mailing list Python-Dev at python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/guido%40python.org

-- --Guido van Rossum (python.org/~guido)



More information about the Python-Dev mailing list