thinkings on shallow copy

Kendear kendear at
Thu Jun 19 23:05:47 CEST 2003

Steven Taschuk wrote:
> Quoth Kendear:
>>i was just looking at docstrings and saw the one
>>for copy.__doc__ regarding copy.copy():
>> > - A shallow copy constructs a new compound object and then (to the
>> >   extent possible) inserts *the same objects* into in that the
>> >   original contains.
>>I wonder if it is actually to insert *the same object references*
>>into the new compound object...
> Sort of.  Better: "inserts references to the same objects".
> (Saying that the references are the same suggests, erroneously,
> that changing one reference would change the other:

hm, why would it suggest that?  if two pointers are the
same, why would changing one pointer change the other?

essentially, "same object references" are the same as
"references to the same objects"... just as
"character pointer" is the same as "pointer to character"
in C.

More information about the Python-list mailing list