gu schreef:
> copyOfA = a
> 
> now, in the second "for" cycle and in functionA() i only 'touch' copyOfA 
> (altering it).

copyOfA isn't a copy of a; it's a different name bound to the same 
object as a. You can verify that: id(a) and id(copyOfA) will return the 
same value.

To make a copy of a (assuming a is a dict), you can do:

copyOfA = dict(a)

or

copyOfA = a.copy()

or more generally

import copy
copyOfA = copy.copy(a)


Cheers,
Roel

-- 
If I have been able to see further, it was only because I stood
on the shoulders of giants.  -- Isaac Newton

Roel Schroeven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to