strange behaviour at termination time

Ovidiu Predescu ovidiu at cup.hp.com
Wed Jun 30 20:57:23 EDT 1999


Greg Ewing wrote:

> To avoid problems like this, you have to design
> your __del__ methods so that they can do their
> work without having to refer to any module-level
> names at the time they are called. One way is
> to use the default-argument trick:
> 
> class B (A) :
>     def __del__ (self, A = A) :
>         A.__del__ (self)

Can you explain why this trick works? When are the default arguments
stored in the method instance? I guess this happens when the method
instance for __del__ is created by the interpreter, right?

Thanks,
-- 
Ovidiu Predescu <ovidiu at cup.hp.com>
http://www.geocities.com/SiliconValley/Monitor/7464/




More information about the Python-list mailing list