From: R David Murray Date: Wed, 5 Feb 2014 19:53:40 +0000 (-0500) Subject: #14515: clarify that TemporaryDirectory's __enter__ returns the name. X-Git-Tag: v3.4.0rc1~79^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=23686074b0e665395b5b4d238663574f576cc2e3;p=python #14515: clarify that TemporaryDirectory's __enter__ returns the name. --- diff --git a/Doc/library/tempfile.rst b/Doc/library/tempfile.rst index 13b6041d04..d78159d64b 100644 --- a/Doc/library/tempfile.rst +++ b/Doc/library/tempfile.rst @@ -97,12 +97,14 @@ The module defines the following user-callable items: 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.