diff mercurial/lsprof.py @ 9032:1fa80c5428b8

compat: use 'key' argument instead of 'cmp' when sorting a list
author Alejandro Santos <alejolp@alejolp.com>
date Sun, 05 Jul 2009 11:02:00 +0200
parents 553aa0cbeab6
children 23cf7b52785a
line wrap: on
line diff
--- a/mercurial/lsprof.py	Sun Jul 05 11:01:30 2009 +0200
+++ b/mercurial/lsprof.py	Sun Jul 05 11:02:00 2009 +0200
@@ -26,12 +26,10 @@
         """XXX docstring"""
         if crit not in profiler_entry.__dict__:
             raise ValueError("Can't sort by %s" % crit)
-        self.data.sort(lambda b, a: cmp(getattr(a, crit),
-                                        getattr(b, crit)))
+        self.data.sort(key=lambda x: getattr(x, crit), reverse=True)
         for e in self.data:
             if e.calls:
-                e.calls.sort(lambda b, a: cmp(getattr(a, crit),
-                                              getattr(b, crit)))
+                e.calls.sort(key=lambda x: getattr(x, crit), reverse=True)
 
     def pprint(self, top=None, file=None, limit=None, climit=None):
         """XXX docstring"""