Jack wrote:

>>> 2. what's the right way to call mylib_exit()? I put it in __del__(self)
>>> but it is not being called in my simple test.
>>
>> instance.__del__ is only called when there are no references to the
>> instance.
> 
> I didn't call del explicitly. I'm expecting Python to call it when
> the program exits. I put a logging line in __del__() but I never
> see that line printed. It seems that __del__() is not being called
> even when the program exits. Any idea why?

If you make your extension available as a module (Python or C), you can use
atexit: http://docs.python.org/lib/module-atexit.html

Note: your exit handler will only be called at normal termination.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to