[Tutor] Object attributes surviving deletion

ALAN GAULD alan.gauld at btinternet.com
Fri Jun 27 01:18:36 CEST 2008


> > Then database will be shared by all instances of Grammars
>
> No, the assignment
>  gram.database = {}
> will always (at least absent any extra magic) create an instance attribute.

Ah yes, silly me. The assignment creates a new instance variable. 
If you were only reading gram.database it would use the shared class 
variable but as you say, assigning will create a new instance version. Oops!

In that case the only thing I can think of is that there is some external 
reference to the dictionary somewhere and that is being assigned to the 
instance one each time somehow? Do you have any class or instance 
managers or Pool objects by any chance?

Otherwise I'm stumped.

Alan G.



More information about the Tutor mailing list