why uses tempfile.mktemp() "@" ?

Jeff Epler jepler at unpythonic.net
Fri Jun 4 12:35:46 EDT 2004


I'm not sure why "@" was chosen, but I've never had any problems with
it.  I searched within the bash manual, and the only special meaning for
@ is when it is used as a variable name in a substitution ("$@"), as a
subscript in a substitution ("${name[@]}"), or when extglob is set, when
followed by an open-paren ("@(a|b|c)").  @ also has special meaning when
using tab-completion, but this shouldn't come into play.

You can probably change the behavior at runtime with something like
this:
>>> import tempfile, os
>>> def gettempprefix():
...         return "_%r-" % os.getpid()
... 
>>> tempfile.gettempprefix = gettempprefix
>>> tempfile.mktemp()
'/tmp/_21830-0'

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20040604/d6b30c50/attachment.sig>


More information about the Python-list mailing list