why uses tempfile.mktemp() "@" ?

Peter Otten __peter__ at web.de
Fri Jun 4 19:28:12 CEST 2004


Jeff Epler wrote:

> I'm not sure why "@" was chosen, but I've never had any problems with

$ python2.2 -c"import tempfile;print tempfile.mktemp()"
/tmp/@3541.0
$ python2.3 -c"import tempfile;print tempfile.mktemp()"
/tmp/tmpLmdDeT

Whatever the reason was, it was changed in Python 2.3 anyway.

The following excerpt from the documentation may also be of interest for you
and the OP:

"""
mktemp(
[suffix][, prefix][, dir])

Deprecated since release 2.3. Use mkstemp() instead.
 Return an absolute pathname of a file that did not exist at the time the
call is made. The prefix, suffix, and dir arguments are the same as for
mkstemp(). 

Warning: Use of this function may introduce a security hole in your program.
By the time you get around to doing anything with the file name it returns,
someone else may have beaten you to the punch. 
"""

Peter




More information about the Python-list mailing list