Copy a string: Difference between revisions

→‎[[Python]]: Corrected "actual copy" code which doesn't, you know, actually copy.
No edit summary
(→‎[[Python]]: Corrected "actual copy" code which doesn't, you know, actually copy.)
Line 190:
dst = src
 
There's no way to actually copy a string in Python; all of the standard methods (the unconstrained index [:], copy.copy, copy.deepcopy) all return the same string object, since they're immutable.
To actually copy the string:
dst = src[:]
 
==[[Ruby]]==
Anonymous user