'Compare two packages, where the "better" package sorts lower.'

def __cmp__(self, other):

    if (not isinstance(other, PimpPackage)):
        return cmp(id(self), id(other))
    if (self.name() != other.name()):
        return cmp(self.name(), other.name())
    if (self.version() != other.version()):
        return (- cmp(self.version(), other.version()))
    return self._db.preferences.compareFlavors(self.flavor(), other.flavor())
