[Tutor] Problem with copy

Tesla Coil tescoil@irtc.net
Tue, 21 Aug 2001 17:48:20 -0500


21 Aug 2001, Bill Ferreira wrote:
> My understanding is that the purpose of copy is to
> insure that the target object (ix in this case) is
> a different object than the source object (x).

copy.copy is a shallow copy.

>>> import copy
>>> x=1
>>> ix = copy.deepcopy(x)
>>> ix is x
1
>>> x = 2
>>> x is ix
0