Anonymous user
Copy a string: Difference between revisions
Show how all copy operations return the same string
(→[[Python]]: Corrected "actual copy" code which doesn't, you know, actually copy.) |
(Show how all copy operations return the same string) |
||
Line 186:
'''Interpeter:''' Python 2.3, 2.4, 2.5
Since strings are immutable,
src = "Hello"▼
dst = src▼
<pre>
>>> b = src[:]
>>> import copy
>>> c = copy.copy(src)
>>> d = copy.deepcopy(src)
>>> src is a is b is c is d
True
</pre>
==[[Ruby]]==
|