New submission from Madhav Datt: The problem is described with an example in this StackOverflow question (https://stackoverflow.com/questions/26589805/python-enums-across-modules). Like in C and other languages, I would expect Enum equality to work across modules and not compare enum states/values, instead of just checking for the same object.
A possible simple fix for this problem would be to override the __eq__() function by default in the enum.Enum class with the following: def __eq__(self, other): if isinstance(other, self.__class__): return self.value == other.value return False I would be happy to create a GitHub pull request to fix this, however, I do not have the experience or knowledge to know if - the current behavior is by design; - whether this is worth fixing; and - whether fixing this will break anything else. ---------- components: Library (Lib) messages: 294983 nosy: Madhav Datt priority: normal severity: normal status: open title: Enum equality across modules: comparing objects instead of values type: behavior versions: Python 2.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30545> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com