Steve Holden wrote:

> What I will repeat, however, is that while there is a *slight*
> difference is semantics between
> 
> s = "some string"
> s1 = s
> 
> and
> 
> s = "some string"
> s1 = copy.copy(s)
> 
> that difference is only to ensure that s and s1 point to different
> copies of the same string in the latter case, whereas in the former case
> s and s1 point to the same string.

No, both "point" to the same string:

>>> import copy
>>> s = "some string"
>>> s1 = s
>>> s1 is s
True
>>> s2 = copy.copy(s)
>>> s2 is s
True

copy.copy() is just an expensive no-op here.

Peter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to