This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pydoc for tempfile.TemporaryDirectory should say it returns the name
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.5
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: docs@python Nosy List: Thomas Thurman, docs@python, iritkatriel, r.david.murray
Priority: normal Keywords:

Created on 2017-07-27 15:05 by Thomas Thurman, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 2916 closed python-dev, 2017-07-27 15:09
Messages (4)
msg299317 - (view) Author: Thomas Thurman (Thomas Thurman) Date: 2017-07-27 15:05
Currently the pydoc for tempfile.TemporaryDirectory begins

"Create and return a temporary directory."

It doesn't explain anywhere *what* it returns (in fact, it returns the name of the directory as a string). The return type is further obscured by TemporaryDirectory being a context manager.
msg299328 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-07-27 17:22
It actually returns the path, since "name" often means the last component of the path.  Just saying "path" might be confused with pathlib, though.  So I guess we'd have to say "returning its path as a string", which sounds awkward.  The original wording is in fact accurate, since most people will understand "the directory" as the directory path as a string.  I'm not sure this change would be an improvement.  I'm not saying no, though.  I guess you'd say I'm -0 on changing it.
msg299386 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2017-07-28 13:41
Boy, I wasn't thinking very clearly when I wrote that.

As pointed out on the PR, tempfile.TemporaryDirectory of course returns a TemporaryDirectory object.  That's in the nature of Python.  I was reading so poorly that I didn't even notice it was the docstring you were modifying :(

The main docs phrase this more clearly, especially the sentence that says the name can be retrieved from the name property (and I see I was wrong, it does use 'name', not 'path').  We don't want to copy all of the text from there, but it could be used as a model to improve the phrasing.
msg411601 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2022-01-25 14:43
The OP seems to have abandoned this and all it got was a +0 for changing, so I suggest we close it.
History
Date User Action Args
2022-04-11 14:58:49adminsetgithub: 75240
2022-02-06 19:16:21iritkatrielsetstatus: pending -> closed
stage: resolved
2022-01-25 14:43:06iritkatrielsetstatus: open -> pending

nosy: + iritkatriel
messages: + msg411601

resolution: wont fix
2017-07-28 13:41:49r.david.murraysetmessages: + msg299386
2017-07-27 17:22:57r.david.murraysetnosy: + r.david.murray
messages: + msg299328
2017-07-27 15:09:45python-devsetpull_requests: + pull_request2968
2017-07-27 15:05:53Thomas Thurmancreate