Simplify cmp_sort_key._cmp_key.__lt__(). (trunk r12817)
authorZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 07:44:52 +0000 (07:44 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 11 Mar 2009 07:44:52 +0000 (07:44 -0000)
svn path=/main/branches/2.1.6/; revision=13049

pym/portage/util.py

index a881bd77f10ddaa4f3ba6d2ab32f13e47239abfa..c78c3b2f920613e74640d7e9e27e258c55ee22b2 100644 (file)
@@ -668,12 +668,10 @@ class cmp_sort_key(object):
                        self._obj = obj
 
                def __lt__(self, other):
-                       if not isinstance(other, self.__class__):
+                       if other.__class__ is not self.__class__:
                                raise TypeError("Expected type %s, got %s" % \
                                        (self.__class__, other.__class__))
-                       if self._cmp_func(self._obj, other._obj) < 0:
-                               return True
-                       return False
+                       return self._cmp_func(self._obj, other._obj) < 0
 
 def unique_array(s):
        """lifted from python cookbook, credit: Tim Peters