R. David Murray added the comment:

What is actually happening is that the *contents* of the list are copied, but 
the list itself is not.  This is a consequence of the definition in terms of +. 
 So, yes, that is a shallow copy, but not quite in the sense that mylist.copy() 
is a shallow copy, since the references to the contents of s get appended to 
the list being constructed by *, not a new list that is a "copy" of s.

You are correct that "s is only referenced" is not really accurate.  But how 
about "Note that the contents of the *s* object are not copied, they are 
referenced multiple times".  I think that highlights the source of the 
confusion: that the *contents* are not copied.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue23406>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to