[issue17947] Code, test, and doc review for PEP-0435 Enum

Nick Coghlan report at bugs.python.org
Sat May 11 05:09:06 CEST 2013


Nick Coghlan added the comment:

Two requests:

1. Lose the frame hack. With the explicit "module=__name__" API available, the implicit fragile magic isn't necessary and leads to Enum instances that may or may not support pickling depending on the implementation. Better to say "if you use the functional API without passing the module name, your Enum instances won't support pickling".

2. Mike Bayer (SQL Alchemy author) has requested the ability to derive a custom metaclass that turns off the Enums-with-members-are-final subclassing restriction (relaxing the rule that members of an enum are instances of that enum to "members of an enum are instances of that enum, or one of its parent enums", but otherwise keeping the same behaviour as the standard enums).

Barry would probably appreciate this capability, too ;)

We don't need to explicitly support this for the initial patch (besides, as I read the current code, you can get something like this already just by overriding EnumMeta._get_mixins), but we may want to revisit it as a supported subclassing API at some point in the future.

----------
nosy: +ncoghlan

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17947>
_______________________________________


More information about the Python-bugs-list mailing list