[issue19249] Enumeration.__eq__

Nick Coghlan report at bugs.python.org
Sun Nov 10 09:47:31 CET 2013


Nick Coghlan added the comment:

Since the default eq implementation handles ducktyping correctly, dropping the Enum specific __eq__ implementation should be fine.

Just make sure this still works:

>>> class AlwaysEqual:
...     def __eq__(self, other):
...         return True
... 
>>> from enum import Enum
>>> class MyEnum(Enum):
...     a = 1
... 
>>> MyEnum.a == AlwaysEqual()
True
>>> AlwaysEqual() == MyEnum.a
True

----------
nosy: +ncoghlan
stage:  -> test needed

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


More information about the Python-bugs-list mailing list