a question in python curses modules

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Fri Feb 15 13:05:44 EST 2008


On Fri, 15 Feb 2008 15:10:12 +0000, Sion Arrowsmith wrote:

> Marc 'BlackJack' Rintsch  <bj_666 at gmx.net> wrote:
>>When the interpreter shuts down it has to remove objects.  Everything you
>>need in a `__del__()` method must be referenced by that object to be sure
>>that it is still there and not already garbage collected.  *But* it's not
>>guaranteed that `__del__()` is called at all!
> 
> This may be true, but it's not really the point here, since clearly
> __del__() *is* being called, otherwise how would the OP know that
> curses was None in it?

It's not the point the OP asked for directly but just the answer in the
first two sentences might have left the impression it's okay to use
`__del__()` for this kind of clean up if you make sure that `curses` is
bound to the object.  Then it may appear to work for the OP but it's not
guaranteed to work under all circumstances.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list