> This can even be done automagically by using object finalization.

To wit:

import sys, os

class Tempfilename:

    def __init__(self):

        import tempfile
        self.__filepath = tempfile.mktemp()

    def path(self):
        return self.__filepath

    def __del__(self):
        if os.path.exists(self.__filepath):
            os.unlink(self.__filepath)



tfn = Tempfilename()
f = open(tfn.path(), 'w')
f.write("something")
f.close()
# now the file exists
sys.exit()
# now the file doesn't exist, because it was garbage collected on the exit.

Bill

_______________________________________________
plucker-dev mailing list
[EMAIL PROTECTED]
http://lists.rubberchicken.org/mailman/listinfo/plucker-dev

Reply via email to