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: Add optional user argument to pathlib.Path.home()
Type: Stage: resolved
Components: Library (Lib) Versions: Python 3.7
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: Nosy List: josh.r, serhiy.storchaka
Priority: normal Keywords:

Created on 2016-10-19 17:34 by josh.r, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (2)
msg278988 - (view) Author: Josh Rosenberg (josh.r) * (Python triager) Date: 2016-10-19 17:34
os.path.expanduser supports both '~' and '~username` constructs to get home directories. It seems reasonable for pathlib.Path.home to default to getting the current user's home directory, but support passing an argument to get the home directory for another user. It means no need to use os.path.expanduser for the purpose (which always strikes me as a little "ugly" for portable code; the ~ works, but it's using UNIX syntax in a way that makes it feel non-portable), making pathlib a more complete replacement.
msg278989 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-10-19 18:17
pathlib.Path.home() don't support the user argument for reasons.

The main problem is that os.path.expanduser() for other users is faked on Windows. It uses guessing, and perhaps it returns correct result in most cases. But in non-standard situations, if current user or other users have non-default home directory, it returns wrong result. I don't know wherever it works for users with non-ascii names or names containing special characters.
History
Date User Action Args
2022-04-11 14:58:38adminsetgithub: 72663
2022-01-19 00:12:53iritkatrielsetstatus: open -> closed
resolution: rejected
stage: resolved
2016-10-19 18:17:27serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg278989
2016-10-19 17:34:22josh.rcreate