Weird Python behaviour

2010-08-10 Thread Jonas Nilsson
Hello, Lets say that I want to feed an optional list to class constructor: class Family(): def __init__(self, fName, members = []): self.fName = fName self.members = members Now, lets add members to two different instances of Family: f1 = Family(Smith)

Re: Weird Python behaviour

2010-08-10 Thread Jonas Nilsson
On 10 Ago, 13:58, Jonas Nilsson j...@spray.se wrote: You stumbled in two python common pitfalls at once :-) One, the default arguments issue, was already pointed to you. The other one is that python variables are just names for objects. Assigning a variable never mean making a copy