[Python-Dev] Warn about mktemp once again? (original) (raw)
Guido van Rossum guido at python.org
Tue Apr 29 01:50:19 CEST 2008
- Previous message: [Python-Dev] Warn about mktemp once again?
- Next message: [Python-Dev] Warn about mktemp once again?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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/)
- Previous message: [Python-Dev] Warn about mktemp once again?
- Next message: [Python-Dev] Warn about mktemp once again?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]