From 89a6082ba9e3cd923104d5deff147d5052f0eb78 Mon Sep 17 00:00:00 2001 From: Kazuhiko Shiozaki <kazuhiko@nexedi.com> Date: Tue, 23 Sep 2008 15:12:52 +0000 Subject: [PATCH] use sort(key=) instead of sort(cmp=) for better performance. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@23767 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/Base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py index 82877af188..c339e11bce 100644 --- a/product/ERP5Type/Base.py +++ b/product/ERP5Type/Base.py @@ -2252,7 +2252,7 @@ class Base( CopyContainer, value = self._getCategoryTool().resolveCategory(path) if value is not None: result += [value] - result.sort(lambda x, y: cmp(getattr(x,sort_id)(),getattr(y,sort_id)())) + result.sort(key=lambda x: getattr(x,sort_id)()) if method_id is None: return [(x, x) for x in membership_list] return [(x,getattr(x, method_id)()) for x in membership_list] -- 2.30.9