On Tue Sep 23 2014 at 3:20:09 AM Tarek Ziadé <
tarek@ziade.org> wrote:
Hello
I realize I am using a lot this pattern:
>>> os.path.join(os.path.expanduser('~'), 'something', 'here')
'/Users/tarek/something/here'
It's quite complicated, and not really intuitive.
What about adding in os.path a "joinuser()" equivalent function, e.g.
>>> os.path.joinuser('something', here')
'/Users/tarek/something/here'
With an optional "user" argument when you want to specify the ~user
>>> os.path.joinuser('something', here', user="foo")
'/Users/bill/something/here'
That would be, in my opinion, much more explicit & readable.
If there's already something like that in the stdlib, forgive my ignorance!
You probably want to propose a change off of pathlib instead of os.path since that's the future of high-level path manipulation in the stdlib.