big objects and avoiding deepcopy?

Reckoner reckoner at gmail.com
Fri Oct 24 14:11:40 EDT 2008


I am writing an algorithm that takes objects (i.e. graphs with
thousands of nodes) into a "hypothetical" state. I need to keep a
history of these  hypothetical objects depending on what happens to
them later. Note that these hypothetical objects are intimately
operated on, changed, and made otherwise significantly different from
the objects they were copied from.

I've been using deepcopy to push the objects into the hypothetical
state where I operate on them heavily. This is pretty slow since the
objects are very large.

Is there another way to do this without resorting to deepcopy?

by the way, the algorithm works fine. It's just this part of it that I
am trying to change.

Thanks in advance.



More information about the Python-list mailing list