[docs] report a document bug in module tempfile

huarong huo huohuarong at gmail.com
Mon May 20 12:21:24 CEST 2013


The document<file:///C:/Users/Dell/Dropbox/Documents/python-2.7.4-docs-html/python-2.7.4-docs-html/library/tempfile.html>
 says:

tempfile.NamedTemporaryFile([*mode='w+b'*[, *bufsize=-1*[, *suffix=''*[, *
prefix='tmp'*[, *dir=None*[,
*delete=True*]]]]]])<file:///C:/Users/Dell/Dropbox/Documents/python-2.7.4-docs-html/python-2.7.4-docs-html/library/tempfile.html#tempfile.NamedTemporaryFile>

This function operates exactly as
TemporaryFile()<file:///C:/Users/Dell/Dropbox/Documents/python-2.7.4-docs-html/python-2.7.4-docs-html/library/tempfile.html#tempfile.TemporaryFile>
does,
except that the file is guaranteed to have a visible name in the file
system(on Unix, the directory entry is not unlinked). That name can be
retrieved
from the name attribute of the file object.

But They both have a name attribute as follow:

In [1]: import tempfile

In [2]: a = tempfile.TemporaryFile()

In [3]: a.name
Out[3]: 'c:\\users\\dell\\appdata\\local\\temp\\tmptkebgx'

In [4]: b = tempfile.NamedTemporaryFile()

In [5]: b.name
Out[5]: 'c:\\users\\dell\\appdata\\local\\temp\\tmpwqmonk'

So what's the difference?

my machine:
python: 2.7.4
os: windows 7 (32bit)

Thank you!

Huo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20130520/3f651ea4/attachment-0001.html>


More information about the docs mailing list