os.tmpfile() vs. tempfile.TemporaryFile()

Carl Banks pavlovevidence at gmail.com
Fri Nov 12 09:46:06 CET 2010

On Nov 11, 10:32 am, John Nagle <na... at animats.com> wrote:
>    Is there any reason to prefer "tempfile.TemporaryFile()"
> over "os.tmpfile()"?  Both create a nameless temporary file
> that will be deleted on close.

os.tmpfile calls your OS's tmpfile system call.
tempfile.TemporaryFile creates the temporary file itself.

So, if you trust your OS more than Python, use os.tempfile.

I-only-use-tempfile-module-ly yr's,

Carl Banks

More information about the Python-list mailing list