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 <rep...@bugs.python.org>
<http://bugs.python.org/issue19249>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to