Hi,<br><br><div class="gmail_quote">2011/6/7 Válas Péter <span dir="ltr"><<a href="mailto:sulinet@postafiok.hu">sulinet@postafiok.hu</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi,<br><br>let X be a mutable container, such as dict/set/list=bytearray, and Y=X,<br>When I change X, Y will follow it, having always the same value, although id(X)!=id(Y). </blockquote><div><br>That's not correct:<br>
<br>Python 2.7 (r27:82525, Jul 4 2010, 07:43:08) [MSC v.1500 64 bit (AMD64)] on win<br>32<br>Type "help", "copyright", "credits" or "license" for more information.<br>>>> x=[1,2,3]<br>
>>> y=x<br>>>> id(x)<br>36115464L<br>>>> id(y)<br>36115464L<br>>>> x.append(4)<br>>>> id(x)<br>36115464L<br>>>> id(y)<br>36115464L<br>>>> x<br>[1, 2, 3, 4]<br>
>>><br><br>As you can see, x and y are references to the same object (e.g. with the same id.)<br><br>Regards<br><br>Walter<br></div></div>