Issue 31057: pydoc for tempfile.TemporaryDirectory should say it returns the name (original) (raw)

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:49 admin set github: 75240
2022-02-06 19:16:21 iritkatriel set status: pending -> closedstage: resolved
2022-01-25 14:43:06 iritkatriel set status: open -> pendingnosy: + iritkatrielmessages: + resolution: wont fix
2017-07-28 13:41:49 r.david.murray set messages: +
2017-07-27 17:22:57 r.david.murray set nosy: + r.david.murraymessages: +
2017-07-27 15:09:45 python-dev set pull_requests: + <pull%5Frequest2968>
2017-07-27 15:05:53 Thomas Thurman create