classes and list as parameter, whats wrong?

Diez B. Roggisch deets at nospam.web.de
Fri Aug 26 07:56:33 EDT 2005


Dirk Zimmermann wrote:

> But still, it is not absolutely clear for me, what is going on. So, at
> least just for my understanding: The parameter LL is created just once
> for the whole class and not for the object 

Yes. And because a lists are mutable, you can alter that one instance of 
the list - and teh following instances of your class ill see the 
changes. This is really a common mistake.

Diez



More information about the Python-list mailing list