Re: Help - strange behaviour from python list

2006-04-11 Thread Sean Hammond
Right, thanks everyone, that's a useful lesson learned. As I suspected I was being tripped over by some feature of Python I was unaware of. I had been looking up lists in the documentation, not functions, and could find no explanation. Prbolem solved! -- -- http://mail.python.org/mailman/li

Re: Help - strange behaviour from python list

2006-04-11 Thread Fredrik Lundh
Sean Hammond wrote: > I've managed to create a scenario in which editing an object in a list of > objects seems to edit every object in the list, rather than just the one. > I'm totally stumped and wondered if anyone would be kind enough to read my > explanation and see if they have any suggestion

Re: Help - strange behaviour from python list

2006-04-11 Thread Duncan Booth
Sean Hammond wrote: > class Area: > def __init__(self, occupants = []): >self.occupants = occupants > ... > I must be making some really stupid mistake, but this just doesn't > look like the list behaviour I would expect. What's going on here? Whenever you use the default value

Re: Help - strange behaviour from python list

2006-04-11 Thread Schüle Daniel
Sean Hammond schrieb: > > I've managed to create a scenario in which editing an object in a list > of objects seems to edit every object in the list, rather than just the > one. I'm totally stumped and wondered if anyone would be kind enough to > read my explanation and see if they have any sug