On Wed, May 1, 2013 at 10:21 AM, Ethan Furman <ethan@stoneleaf.us> wrote:True, and Enum itself also falls in this category. Maybe there could
> We may not want to /completely/ disallow subclassing. Consider:
>
> --> class StrEnum(str, Enum):
> ... '''string enums for Business Basic variable names'''
> ...
> --> class Vendors(StrEnum):
> EnumError: subclassing not allowed
>
>
> My point is that IntEnum, StrEnum, ListEnum, FloatEnum are all "subclasses"
> of Enum. To then have a subclass of
> that, such as Season(StrEnum), is subclassing a subclass.
be a special marker that you have to set in the class body (or a
keyword arg in the class statement) to flag that a class is meant as a
"category of enums" rather than a specific enum type. Such categorical
classes should not define any instances. (And maybe "defines no
instances" is enough to flag an Enum class as subclassable.)
Indeed, given that we mostly want IntEnum as a last-resort backward
> Now, if we do want to completely disallow it, we can ditch IntEnum and force
> the user to always specify the mixin
> type:
>
> --> class Season(str, Enum):
> .
> .
> .
>
> --> class Names(str, Enum):
> .
> .
> .
>
> But that's not very user friendly... although it's not too bad, either.
compatibility thing for os and socket, it may not be so bad.