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
On Thu, Nov 6, 2008 at 11:59 PM, yoma [EMAIL PROTECTED] wrote:
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*
On Thu, 06 Nov 2008 23:59:51 -0800, yoma wrote:
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
yoma wrote:
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