Просмотр исходного кода

better cmp operator for mismatched classes

Joe Shochet 21 лет назад
Родитель
Сommit
d855d6c85a
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      direct/src/ffi/FFIExternalObject.py

+ 2 - 1
direct/src/ffi/FFIExternalObject.py

@@ -183,8 +183,9 @@ class FFIExternalObject:
         if isinstance(other, self.__class__):
             return self.compareTo(other)
         # Otherwise, they must not be the same
+        # Just do a basic python id compare
         else:
-            return 1
+            return cmp(id(self), id(other))
 
     def __repr__(self):
         # Lots of Panda classes have an output function defined that takes an Ostream