[gedit-plugins/wip/python3: 8/19] Change __cmp__ to __lt__



commit 3a14767d2d6182e95b8d6c1917371a8383542c01
Author: Jesse van den Kieboom <jessevdk gnome org>
Date:   Fri Nov 9 10:18:53 2012 +0100

    Change __cmp__ to __lt__

 plugins/commander/commander/commands/method.py |    4 ++--
 plugins/commander/commander/commands/result.py |    8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/plugins/commander/commander/commands/method.py b/plugins/commander/commander/commands/method.py
index 618b835..8b949e1 100644
--- a/plugins/commander/commander/commands/method.py
+++ b/plugins/commander/commander/commands/method.py
@@ -120,8 +120,8 @@ class Method:
 
     def __lt__(self, other):
         if isinstance(other, Method):
-            return (self.name > other.name) - (self.name < other.name)
+            return self.name < other.name
         else:
-            return (self.name > other) - (self.name < other)
+            return self.name < other
 
 # vi:ex:ts=4:et
diff --git a/plugins/commander/commander/commands/result.py b/plugins/commander/commander/commands/result.py
index faef011..8cc9fc3 100644
--- a/plugins/commander/commander/commands/result.py
+++ b/plugins/commander/commander/commands/result.py
@@ -31,11 +31,11 @@ class Result(object):
     def __int__(self):
         return self._value
 
-    def __cmp__(self, other):
-        if isinstance(other, int) or isinstance(other, Result):
-            return cmp(int(self), int(other))
+    def __lt__(self, other):
+        if isinstance(other, Result):
+            return int(self) < int(other)
         else:
-            return 1
+            return int(self) < other
 
 # Easy shortcuts
 HIDE = Result(Result.HIDE)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]