From 544fcdb27461b06e5af39c1f25029d2b645b476f Mon Sep 17 00:00:00 2001 From: Vincent Pelletier <vincent@nexedi.com> Date: Fri, 28 Dec 2007 14:41:19 +0000 Subject: [PATCH] Use iteritems to get rid of some property & key lookups. git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@18548 20353a03-c40f-0410-a6d1-a30d3c3de9de --- product/ERP5Type/XMLMatrix.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/product/ERP5Type/XMLMatrix.py b/product/ERP5Type/XMLMatrix.py index 90daa8966f..50819e6d8c 100644 --- a/product/ERP5Type/XMLMatrix.py +++ b/product/ERP5Type/XMLMatrix.py @@ -204,17 +204,15 @@ class XMLMatrix(Folder): if self.index.has_key(base_id): # Look at each dimension i of the previous index - for i in self.index[base_id].keys(): + for i, i_value in self.index[base_id].iteritems(): # If the new index has the same dimensionality # Look at new location of cells if new_index.has_key(i): temp = {} # Look at each index in a given dimension i - for my_id in self.index[base_id][i].keys(): - new_place = new_index[i].get(my_id) - old_place = self.index[base_id][i][my_id] + for my_id, my_value in i_value.iteritems(): # create a movement in dimension i between old_place and new_place - temp[old_place] = new_place + temp[my_value] = new_index[i].get(my_id) movement[i] = temp # Rename every 'object_id' by 'temp_object_id' -- 2.30.9