cleanup after exceptions
Padraig at Linux.ie
Padraig at Linux.ie
Thu Dec 18 14:11:12 EST 2003
Hi,
I'm a little confused why objects
are not deleted after they go
out of scope due to an exception?
For e.g.
>>> import time
>>>
>>> def f():
>>> myfile=open("file.test","w")
>>> myfile.write("not flushed\n")
>>> exception=throw
>>>
>>> f()
>>> time.sleep(10)
The file is not written/closed until
the python interpreter exits.
The same thing applies to other objects.
cheers,
Pádraig.
More information about the Python-list
mailing list