From ea072660146e8af25b1d492d868458db66791378 Mon Sep 17 00:00:00 2001 From: Yoshinori Okuji <yo@nexedi.com> Date: Thu, 9 Jun 2005 17:44:19 +0000 Subject: [PATCH] Small optimization of cartesianProduct. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3230 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/Utils.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/product/ERP5Type/Utils.py b/product/ERP5Type/Utils.py index 7445cd4601..18985307b7 100755 --- a/product/ERP5Type/Utils.py +++ b/product/ERP5Type/Utils.py @@ -96,12 +96,13 @@ def cartesianProduct(list_of_list): if len(list_of_list) == 0: return [[]] result = [] + append = result.append head = list_of_list[0] tail = list_of_list[1:] product = cartesianProduct(tail) for v in head: for p in product: - result += [[v] + p] + append([v] + p) return result # Some list operations -- 2.30.9