[Python-Dev] Warn about mktemp once again? (original) (raw)

Guido van Rossum guido at python.org
Tue Apr 29 01:50:19 CEST 2008


I'd be much happier if there was a standard API in tempfile.py that did that for you, so you wouldn't have to understand fdopen(). (Your example is wrong BTW, the open mode would have to be something like 'rb+' or 'wb+'.)

On Mon, Apr 28, 2008 at 4:35 PM, <skip at pobox.com> wrote:

Guido> IMO mkstemp() is a major pain because you have to use raw file Guido> descriptors on the return value. I'd much rather recommend Guido> [Named]TemporaryFile which return streams. Why not: fd, fname = tempfile.mkstemp() f = os.fdopen(fd) Seems fairly straightforward to me. Skip

-- --Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list