[New-bugs-announce] [issue19249] Enumeration.__eq__
CliffM
report at bugs.python.org
Sun Oct 13 21:38:20 CEST 2013
New submission from CliffM:
Given that enumeration members are Singletons, can we not rely on the default
__eq__() method ? (FWIW the existing tests all pass if you delete it)
This might be confusing for a reader later, so needs documenting. Although I think it should be documented (in enum.py) either way.
Maybe also add a singletoness test ?
def test_singleton(self):
class A(Enum):
X=1
Y=2
self.assertTrue(id(A.X)==id(A.X))
Of course there is good chance that there is a test-case I have not thought of that will defeat this. I am thinking about :
a) weak-ref handling of Enums
b) unpickling, say by a user of the ZODB
Which might break the singletonicity. ?? Any offers ??
----------
components: Tests
messages: 199774
nosy: CliffM
priority: normal
severity: normal
status: open
title: Enumeration.__eq__
versions: Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19249>
_______________________________________
More information about the New-bugs-announce
mailing list