[Python-checkins] r59776 - python/trunk/Doc/library/tempfile.rst
georg.brandl
python-checkins at python.org
Sun Jan 6 16:55:26 CET 2008
Author: georg.brandl
Date: Sun Jan 6 16:55:26 2008
New Revision: 59776
Modified:
python/trunk/Doc/library/tempfile.rst
Log:
#1615275: clarify return object types of different tempfile factories.
Modified: python/trunk/Doc/library/tempfile.rst
==============================================================================
--- python/trunk/Doc/library/tempfile.rst (original)
+++ python/trunk/Doc/library/tempfile.rst Sun Jan 6 16:55:26 2008
@@ -34,7 +34,7 @@
.. function:: TemporaryFile([mode='w+b'[, bufsize=-1[, suffix[, prefix[, dir]]]]])
- Return a file (or file-like) object that can be used as a temporary storage
+ Return a file-like object that can be used as a temporary storage
area. The file is created using :func:`mkstemp`. It will be destroyed as soon
as it is closed (including an implicit close when the object is garbage
collected). Under Unix, the directory entry for the file is removed immediately
@@ -49,6 +49,10 @@
The *dir*, *prefix* and *suffix* parameters are passed to :func:`mkstemp`.
+ The returned object is a true file object on POSIX platforms. On other
+ platforms, it is a file-like object whose :attr:`file` attribute is the
+ underlying true file object.
+
.. function:: NamedTemporaryFile([mode='w+b'[, bufsize=-1[, suffix[, prefix[, dir[, delete]]]]]])
@@ -60,6 +64,9 @@
across platforms (it can be so used on Unix; it cannot on Windows NT or later).
If *delete* is true (the default), the file is deleted as soon as it is closed.
+ The returned object is always a file-like object whose :attr:`file` attribute
+ is the underlying true file object.
+
.. versionadded:: 2.3
.. versionadded:: 2.6
@@ -76,6 +83,10 @@
The resulting file has one additional method, :func:`rollover`, which causes the
file to roll over to an on-disk file regardless of its size.
+ The returned object is a file-like object whose :attr:`_file` attribute
+ is either a :class:`StringIO` object or a true file object, depending on
+ whether :func:`rollover` has been called.
+
.. versionadded:: 2.6
More information about the Python-checkins
mailing list