So this seems like it will make scope/namespaces a bit interesting...<br><br>Any good references on why this is this way?<br>I.e., why assignment passes across scopes instead of copy.<br>Or is it just explicit versus implicit?
<br><br><br><br><div class="gmail_quote">On Jan 21, 2008 9:32 PM, John Fouhy <<a href="mailto:john@fouhy.net">john@fouhy.net</a>> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On 22/01/2008, John Morris <<a href="mailto:jrmorrisnc@gmail.com">jrmorrisnc@gmail.com</a>> wrote:<br>> I thought each class got it's own namespace and this sharing of mutable<br>> objects is confusing me.
<br><br></div>Each class gets its own namespace, but names are different from<br>objects. For example:<br><br>>>> x = [1, 2, 3]<br>>>> y = x<br>>>> y.append(4)<br>>>> x<br>[1, 2, 3, 4]
<br><br>In this case, x and y are both different names for the same object.<br>Classes increase the name space, but they don't change the fact that<br>in python, assignment is just giving something a new name.<br><br>
--<br><font color="#888888">John.<br></font></blockquote></div><br><br clear="all"><br>-- <br>John Morris<br><a href="mailto:jrmorrisnc@gmail.com">jrmorrisnc@gmail.com</a><br>"Do nothing which is of no use." -- Miyamoto Musashi
<br><a href="<a href="http://profile.mygamercard.net/nerdality">http://profile.mygamercard.net/nerdality</a>"><br><img src="<a href="http://card.mygamercard.net/gbar/abyss/nerdality.gif">http://card.mygamercard.net/gbar/abyss/nerdality.gif
</a>" border=0><br></a>