[Python-Dev] enum discussion: can someone please summarize open issues?

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Apr 29 09:42:04 CEST 2013

Cameron Simpson wrote:
> I'd go a bit further here: I'd take this final sentence as being
> -0 on preventing adding more enumerals(?), whereas I'm a solid -1
> on preventing it. By all means not actively support it, but very
> against doing things that make it hard for a subclass to support
> it.

I had another thought about subclassing. I don't think it
would be a good idea to totally forbid subclassing classes
derived from Enum, because you may want to define an Enum
subclass for the purpose of creating a new *kind* of enum.

For example,

    class FancyEnum(Enum):

       def fancy_str(self):
          return str(self) + " with bells on"

If subclassing a subclass of Enum were prevented somehow,
you would't be able to create any actual enums based on


More information about the Python-Dev mailing list