[Python-checkins] cpython (3.3): #14515: clarify that TemporaryDirectory's __enter__ returns the name.

r.david.murray python-checkins at python.org
Wed Feb 5 20:56:52 CET 2014


http://hg.python.org/cpython/rev/b5fe07d39e16
changeset:   88977:b5fe07d39e16
branch:      3.3
parent:      88974:a5895fca91f3
user:        R David Murray <rdmurray at bitdance.com>
date:        Wed Feb 05 14:53:40 2014 -0500
summary:
  #14515: clarify that TemporaryDirectory's __enter__ returns the name.

files:
  Doc/library/tempfile.rst |  10 ++++++----
  1 files changed, 6 insertions(+), 4 deletions(-)


diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst
--- a/Doc/library/tempfile.rst
+++ b/Doc/library/tempfile.rst
@@ -97,12 +97,14 @@
    This function creates a temporary directory using :func:`mkdtemp`
    (the supplied arguments are passed directly to the underlying function).
    The resulting object can be used as a context manager (see
-   :ref:`context-managers`).  On completion of the context (or destruction
-   of the temporary directory object), the newly created temporary directory
+   :ref:`context-managers`).  On completion of the context or destruction
+   of the temporary directory object the newly created temporary directory
    and all its contents are removed from the filesystem.
 
-   The directory name can be retrieved from the :attr:`name` attribute
-   of the returned object.
+   The directory name can be retrieved from the :attr:`name` attribute of the
+   returned object.  When the returned object is used as a context manager, the
+   :attr:`name` will be assigned to the target of the :keyword:`as` clause in
+   the :keyword:`with` statement, if there is one.
 
    The directory can be explicitly cleaned up by calling the
    :func:`cleanup` method.

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list