freemyipod r604 - Code Review

Jump to: navigation, search
Repository:freemyipod
Revision:r603‎ | r604 | r605 >
Date:03:20, 13 February 2011
Author:farthen
Status:new
Tags:
Comment:
emCORE tools: misc.py: c_enum: Fix non-equality check
Modified paths:
  • /emcore/trunk/tools/misc.py (modified) (history)

Diff [purge]

Index: emcore/trunk/tools/misc.py
@@ -195,9 +195,11 @@
196196 return False
197197
198198 def __ne__(self, other):
199 - if self.value == other:
200 - return False
201 - return True
 199+ if type(other) == str:
 200+ try: return getattr(self, other) != self.value
 201+ except AttributeError: return True
 202+ else:
 203+ return self.value != other
202204
203205
204206 class ExtendedCStruct(LittleEndianStructure):