>>> def f(a={}): return a ... >>> x=f() >>> x[1]=1 >>> print x {1: 1} >>> y=f() >>> print y {1: 1}
On Mar 3, 5:49 pm, ron_m <ron.mco...@gmail.com> wrote: > Ah Ok, I was trying to reproduce with a simple program containing a couple > of classes with a main all in one file but it did not exhibit the problem > behaviour. So having the classes in a module is part of the recipe and lists > and dicts are passed around as object references to the container leaving > the contents open to modification.