[Zope] Changing a COPY of metadata modifies ZClass instance?

Milos Prudek milos.prudek@tiscali.cz
Mon, 25 Mar 2002 11:53:00 +0100


Milos Prudek wrote:
> I think I'm going slightly mad :-)

OK, I tracked it down to what amounts to IMHO a Python feature  :-O

 >>> x=['a','b','c']
 >>> x
['a', 'b', 'c']
 >>> y=x
 >>> y
['a', 'b', 'c']
 >>> y.remove('b')
 >>> y
['a', 'c']
 >>> x
['a', 'c']


This problem applies to lists only... a simple assignment seems to 
assign a reference to original variable instead of creating a copy of 
original variable data.

I use Python 2.1.1 on Linux.

Is this normal Python behaviour?

-- 
Milos Prudek