<div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">The original list 'a', isn't changed in any of these cases right? And<br>
modifying b, c or d would not change 'a' either - or am I not understanding this correctly?<br>
<br>
## 1 ##<br>
<br>
creates a new list and copies all elements from a to b<br>
<br></blockquote><div><br></div><div>Yes.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
## 2 ##<br>
<br>
take an already existing list (empty) and copies all elements from a to<br>
it (no data is lost by c since c was empty to start out with)<br>
<br></blockquote><div><br></div><div>No. The 'already existing list' is simply completely discarded. You're creating it on one line, then destroying it. A brand new list is being created and returned and bound to the same name as the already existing list.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
## 3 ##<br>
<br>
d is a list, and all of its contents (if it had any) would be<br>
filled with that of a .. but changes to a still are not reflected in d<br>
.. this is confusing...<br></blockquote><div><br></div><div><br></div><div>Not exactly, if I understand you correctly. D is a list, but its contents (if it had any) would be completely replaced. Any previous content would be gone, and it would now contain a copy of a. </div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Semi-aside, if I wanted to make local copy of a list sent to me as a<br>
parameter, which of these is the most appropriate to use (I don't want<br>
changes to change the original list sent).<br></blockquote><div><br></div><div><br></div><div>my_copy = original[:]</div></div><br clear="all"><div name="mailplane_signature">--S</div>