[issue27877] Add recipe for "valueless" Enums to docs
John Hagen
report at bugs.python.org
Sun Aug 28 14:38:23 EDT 2016
John Hagen added the comment:
Raymond, thanks for your consideration and input.
I'll work on a small patch unless I hear from Ethan that he'd rather do it. I'm happy to defer to his expertise.
I did try out None as a value just to be sure that that didn't work as it would not be a bad alternative. But since the values are "equal", Enum tries to alias them.
import enum
@enum.unique
class Color(enum.Enum):
red = None
green = None
blue = None
>>> ValueError: duplicate values found in <enum 'Color'>: green -> red, blue -> red
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue27877>
_______________________________________
More information about the Python-bugs-list
mailing list