gpsd-dev
[Top][All Lists]
Advanced

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

[gpsd-dev] [PATCH 04/12] Fixes xgps for Python 3.


From: Fred Wright
Subject: [gpsd-dev] [PATCH 04/12] Fixes xgps for Python 3.
Date: Fri, 8 Apr 2016 10:07:45 -0700

This replaces the obsolete 'cmp' keyword for 'sorted' with the
still-available (and more efficient) 'key' keyword.

TESTED:
Ran xgps with Python 2.7, 3.3, 3.4, and 3.5 (with appropriate
builds).
---
 xgps | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xgps b/xgps
index c7955b4..79fd3fb 100755
--- a/xgps
+++ b/xgps
@@ -785,7 +785,7 @@ class Base:
                     fld = fld[1:]
                 satellites = sorted(
                     satellites[:],
-                    cmp=lambda x, y: cmp(x[fld], y[fld]), reverse=rev)
+                    key=lambda x: x[fld], reverse=rev)
 
             for (i, satellite) in enumerate(satellites):
                 self.set_satlist_field(i, 0, satellite.PRN)
-- 
2.8.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]