does python have useless destructors?

Tim Bradshaw tfb+google at
Fri Jun 11 17:44:39 CEST 2004

"Delaney, Timothy C (Timothy)" <tdelaney at> wrote in message news:<mailman.780.1086840001.6949.python-list at>...

> myfile = open("myfilepath", "w")
> try:
>     myfile.write(reallybigbuffer)
> finally:
>     myfile.close()

I don't think this is save.  Is it certain that there can be no
problem between the open and the try?  The expansion of Lisp macros
which do this typically look like:

myfile = None

    myfile = open(...)
    if myfile

More information about the Python-list mailing list