[Python-ideas] os.path.abspath - optional startdir argument
Serhiy Storchaka
storchaka at gmail.com
Thu Jul 24 21:24:40 CEST 2014
24.07.14 16:45, Wolfgang Maier написав(ла):
> currently, os.path.abspath(somepath) is, essentially, equivalent to
>
> os.path.normpath(os.path.join(os.getcwd(),path)).
Actually currently posixpath.abspath() is more complicated and
ntpath.abspath() has totally different implementation.
> Currently, you have to write:
>
> os.path.normpath(os.path.join(startdir, path))
> or even
> os.path.normpath(os.path.join(os.path.abspath(startdir), path))
Yes, it is natural and straightforward way. You can define your own
function if you need this often.
> Before posting I checked the bug tracker and found that this idea has
> been brought up years ago (http://bugs.python.org/issue9882), but not
> pursued further.
> The patch suggested there is a bit of an oversimplification, but I have
> my own one, which I could provide if someone's interested.
> For issue9882 it was suggested to bring it up on python-ideas, but to
> the best of my knowledge that was never done, so I'm doing it now.
>
> Thoughts ?
This will add to abspath() a feature which is unrelated to the purpose
of abspath(). This will complicate the API without significant benefit.
I'm -1.
More information about the Python-ideas
mailing list