E
Eduardo Suarez-Santana
I wonder whether this is normal behaviour.
I would expect equal sign to copy values from right to left. However, it
seems there is a copy-on-write mechanism that is not working.
Anyone can explain and provide a working example?
Thanks,
-Eduardo
$ python
Python 2.7.2 (default, Oct 31 2011, 11:54:55)
[GCC 4.5.3] on linux2
Type "help", "copyright", "credits" or "license" for more information..... def __init__(self, id, cont):
.... self.id = id;
.... self.cont = cont;
....
I would expect equal sign to copy values from right to left. However, it
seems there is a copy-on-write mechanism that is not working.
Anyone can explain and provide a working example?
Thanks,
-Eduardo
$ python
Python 2.7.2 (default, Oct 31 2011, 11:54:55)
[GCC 4.5.3] on linux2
Type "help", "copyright", "credits" or "license" for more information..... def __init__(self, id, cont):
.... self.id = id;
.... self.cont = cont;
....
r={'a':1};
d={};
d['x']=r;
d['y']=r;
x1 = n('x',d['x']);
y1 = n('y',d['y']);
x1.cont['a']=2;
y1.cont {'a': 2}