Ethan Furman added the comment:
Here's the current __eq__ method:
def __eq__(self, other):
if type(other) is self.__class__:
return self is other
return NotImplemented
It is, in fact, using identity and not value equality.
I'm thinking we should either remove and go with the default __eq__, or change
it to value equality. One possible reason to use value equality is that pickle
protocols below 2 will actually create duplicate Enum members, breaking
identity tests; if someone is stuck using pickle that way, they could still use
Enum with `==` and not `is`.
Identity tests are already incorporated in many of the existing tests.
Gentlemen, what do you think?
----------
assignee: -> ethan.furman
nosy: +barry, eli.bendersky, ethan.furman
type: -> behavior
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue19249>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com