[Tutor] Am I storeing up problems ?
Dave S
pythontut at pusspaws.net
Sun Jan 2 19:38:54 CET 2005
Hi there again,
My matrix 'self.data' consists of a list of 110 items, each item is a
dictionary of 250 keys, each key holds two lists, one of four items, one
of 12 items.
I needed to copy this matrix to 'self.old_data', so I have been using
.deepcopy(), which works OK but is SLOW .... (12+ secs)
Once the matrix is copied, 'self.data' is re-constructed as the
programme gathers data.
To speed things up I changed my code to
# This is the speeded up deepcopy()
self.old_data = self.data
self.data = []
for i in range(110):
self.data.append({})
Query: Is all this OK, it works and quick as well, but I am concerned I
may be leaving garbage in the Python PVM since I am shrugging off old
'self.old_data's which may be mounting up ?
Dave
More information about the Tutor
mailing list