Why doesn't deepcopy work on strings ?

Gerrit Holl gerrit at nl.linux.org
Mon Feb 24 04:49:07 EST 2003


Tony C schreef op maandag 24 februari om 03:27:22 +0000:
> Why doesn't deepcopy() on a string make a deep copy of that string ?
> 
> Would someone explain this ..
> import copy
> s1="monty python"
> s2=copy.deepcopy(s1)
> id(s1)
> 19114192
> id(s2)
> 19114192 

Try: s1[:] to copy a string.

yours,
Gerrit.

-- 
Asperger Syndroom - een persoonlijke benadering:
	http://people.nl.linux.org/~gerrit/
Het zijn tijden om je zelf met politiek te bemoeien:
	http://www.sp.nl/





More information about the Python-list mailing list