[Python-ideas] proposal: os.path.joinuser()

Brett Cannon brett at python.org
Tue Sep 23 17:18:40 CEST 2014


On Tue Sep 23 2014 at 3:20:09 AM Tarek Ziadé <tarek at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140923/ec10033b/attachment.html>


More information about the Python-ideas mailing list