Copy Compound object lists using deepcopy

Sometimes you might get into trouble while copying a compound object list to another in Python. If this is so, then you should use the copy module of Python. To know details about shallow and deep copy operations in Python please visit http://docs.python.org/lib/module-copy.html

To copy simple lists without using copy module of python, you can use the method described in another post of my blog http://love-python.blogspot.com/2008/04/how-to-copy-list-in-python.html
One of my friend found that this method wasn't working for him while copying a graph into another (he used adjacency matrix to represent graph), then he tried deepcopy and got rid of the problem.

Comments

Popular posts from this blog

Strip HTML tags using Python

lambda magic to find prime numbers

Convert text to ASCII and ASCII to text - Python code