A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-April/078929.html below:

[Python-Dev] Warn about mktemp once again?

[Python-Dev] Warn about mktemp once again?Guido van Rossum guido at python.org
Tue Apr 29 01:22:42 CEST 2008
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,  <skip at pobox.com> 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/)
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4