diff options
author | Nick Coghlan <ncoghlan@gmail.com> | 2008-02-09 15:28:09 (GMT) |
---|---|---|
committer | Nick Coghlan <ncoghlan@gmail.com> | 2008-02-09 15:28:09 (GMT) |
commit | 97fac3eb0a7fb42b1853ab41c29377bb3e7f1362 (patch) | |
tree | f3666ce2dff81232c1d2fe32ed45c78206ad21b0 /Doc | |
parent | 8c6c12ca962c0f98cf5a30c6180bca799091f7c5 (diff) | |
download | cpython-97fac3eb0a7fb42b1853ab41c29377bb3e7f1362.zip cpython-97fac3eb0a7fb42b1853ab41c29377bb3e7f1362.tar.gz cpython-97fac3eb0a7fb42b1853ab41c29377bb3e7f1362.tar.bz2 |
Issue 2021: Allow NamedTemporaryFile and SpooledTemporaryFile to be used as context managers. (The NamedTemporaryFile fix should be considered for backporting to 2.5)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/tempfile.rst | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst index ae1c610..2f37ede 100644 --- a/Doc/library/tempfile.rst +++ b/Doc/library/tempfile.rst @@ -51,7 +51,8 @@ The module defines the following user-callable functions: 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. + underlying true file object. This file-like object can be used in a :keyword:`with` + statement, just like a normal file. .. function:: NamedTemporaryFile([mode='w+b'[, bufsize=-1[, suffix[, prefix[, dir[, delete]]]]]]) @@ -65,7 +66,8 @@ The module defines the following user-callable functions: 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. + is the underlying true file object. This file-like object can be used in a :keyword:`with` + statement, just like a normal file. .. versionadded:: 2.3 @@ -85,7 +87,8 @@ The module defines the following user-callable functions: 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. + whether :func:`rollover` has been called. This file-like object can be used in a + :keyword:`with` statement, just like a normal file. .. versionadded:: 2.6 |