Deeper copy than deepcopy

2009-10-27 Thread Scott Pakin
copy.deepcopy apparently preserves multiple references to the same object: $ python Python 2.5.2 (r252:60911, Jan 4 2009, 17:40:26) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import copy >>> d = [1,2,3] >>> r = copy

Re: Deeper copy than deepcopy

2009-10-28 Thread Scott Pakin
Thanks everyone! The list-comprehension approach should work in my case as I know a priori that my data structure is finite. Still, it'd be awfully convenient for Python's copy module to offer a copy.deepercopy function -- even if it comes with the caveat that it will explode if given a data stru