IMO mkstemp() is a major pain because you have to use raw file descriptors on the return value. I'd much rather recommend [Named]TemporaryFile which return streams.
On Mon, Apr 28, 2008 at 4:17 PM, <[EMAIL PROTECTED]> wrote: > > Guido> Have we documented the alternatives well enough? > > I suppose we could document explicitly how to use mkstemp() in place of > mktemp(), but the difference in return value is fairly modest: > > >>> tempfile.mktemp() > '/var/folders/5q/5qTPn6xq2RaWqk+1Ytw3-U+++TI/-Tmp-/tmpV_5OLi' > >>> tempfile.mkstemp() > (3, '/var/folders/5q/5qTPn6xq2RaWqk+1Ytw3-U+++TI/-Tmp-/tmpmS7K4T') > > and the argument list is quite similar as well: > > >>> help(tempfile.mktemp) > Help on function mktemp in module tempfile: > > mktemp(suffix='', prefix='tmp', dir=None) > ... > >>> help(tempfile.mkstemp) > Help on function mkstemp in module tempfile: > > mkstemp(suffix='', prefix='tmp', dir=None, text=False) > ... > > Guido> In most cases NamedTemporaryFile will work, ... > > It's API seems to be a bit farther from the mktemp API than that of mkstemp. > > Skip > -- --Guido van Rossum (home page: http://www.python.org/~guido/) _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com