shallow copy's

Roger roger at efn.org
Fri Jul 5 15:03:33 EDT 2002


Around Fri,Jul 05 2002, at 02:42,  Rajarshi Guha, wrote:
>Hi,
>  I have some code:
>
>a = [1,2,3,4]
>b = a
>
>Do some operations on a
>Will the contents of b mirror a? Or will b remain unchanged?
fire up python and try it. 

b mirrored a with my version.
As in,

a[3]=7
b
[1,2,3,7]



--
Roger
---------------------------------------------------------------------------
roger at efn.org
The following is generated by /usr/games/fortune:
"I just need enough to tide me over until I need more."
		-- Bill Hoest





More information about the Python-list mailing list