New submission from Barney Gale <[email protected]>:
The `pathlib.Path.home()` function looks like:
@classmethod
def home(cls):
"""Return a new path pointing to the user's home directory (as
returned by os.path.expanduser('~')).
"""
return cls(cls()._flavour.gethomedir(None))
If we add a `username=None` parameter and pass this to `gethomedir()` we can
easily add a lookup of another user's home directory, so:
import pathlib
username = 'phil'
pathlib.Path.home(username) == pathlib.Path('~' + username).expanduser()
----------
components: Library (Lib)
messages: 385472
nosy: barneygale
priority: normal
severity: normal
status: open
title: pathlib.Path: add `username` argument to `home()`
type: enhancement
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue42998>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com