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

Eli Bendersky report at bugs.python.org
Sun May 26 18:04:22 CEST 2013


Eli Bendersky added the comment:

I tweaked the code a bit (no functionality changes, mostly cleanups and a bit of refactoring). Figured it will be easier to just send an updated patch than another review. The diff from patch 06 can be seen via the Rietveld interface.

Also, after reading the code more carefully, I think we're doing a mistake by over-complicating it for the sake of custom enum metaclasses and over-customization (like auto numbering). The original point Guido raised against auto-numbering was too much magic in the implementation. Well, we already have that in Lib/enum.py - the code is so complex it seems fragile because of the tight coupling with many class and metaclass related protocols. Just defining a wholly new enum implementation that does something very specific seems simpler than customizing the existing one.

I'd suggest we stick to the existing Enum + IntEnum, giving up the more complex customizations for now. It can always be added in the future if we see it's very important.

----------
Added file: http://bugs.python.org/file30384/pep-0435.07.eliben.patch

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


More information about the docs mailing list