Ethan Furman added the comment: I'm not sure what you are talking about. Here's the code:
try: if value in cls._value2member_map_: return cls._value2member_map_[value] except TypeError: # not there, now do long search -- O(n) behavior for member in cls._member_map_.values(): if member.value == value: return member Here's the test: self.assertEqual(ColorInAList([1]), ColorInAList.red) In order for that test to work, the first if (in the try) raises a TypeError, then execution falls into the except block and each member is tested for equality until one matches (via the if) -- so what is your added test doing that isn't already being done? ---------- assignee: -> ethan.furman nosy: +ethan.furman _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19252> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com