Need a little parse help

Andrew Dalke dalke at dalkescientific.com
Wed May 11 15:48:21 EDT 2005


Delaney, Timothy C (Timothy) wrote:
> Remember, finalisers are not called when Python exits. So if you don't
> explicitly close the file you are *writing* to, it may not be flushed
> before being closed (by the OS because the process no longer exists).

Wrong.

% python
Python 2.3 (#1, Sep 13 2003, 00:49:11) 
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class ABC:
...   def __del__(self):
...     print "I am here!"
... 
>>> abc = ABC()
>>> del abc
I am here!
>>> abc = ABC()
>>> import sys
>>> sys.exit()
I am here!
% 

There's documentation somewhere that describes what occurs
during Python's exit, but I can't find it right now.

				Andrew
				dalke at dalkescientific.com




More information about the Python-list mailing list