python version 2.5 in module copy we all know that copy have two method: copy() and deepcopy(). and the explain is - A shallow copy constructs a new compound object and then (to the extent possible) inserts *the same objects* into it that the original contains.
- A deep copy constructs a new compound object and then, recursively, inserts *copies* into it of the objects found in the original. so i try a example: import copy class A: i = 1 class B: a = A() b = B() x=copy.copy(b) y=copy.deepcopy(b) print id(x.a), id(b.a) print id(y.a), id(y.a) the result: 14505264 14505264 14505264 14505264 So maybe i have a wrong understand to deep copy and shallow copy or it is a bug ? please help me!! -- http://mail.python.org/mailman/listinfo/python-list