[Python-ideas] os.path.abspath - optional startdir argument

Stephen Hansen me+python at ixokai.io
Fri Jul 25 09:54:59 CEST 2014


Warning: Lurker...

On Fri, Jul 25, 2014 at 12:40 AM, Wolfgang Maier <
wolfgang.maier at biologie.uni-freiburg.de> wrote

>
> Yes, the syntax is nicer *now*, but with my proposed change to
> os.path.abspath things would look quite similar:
>
> pathlib version now:
>
>   >>> path.Path('../../../Python27/lib', 'ast.py').resolve()
>>
>
> os.path as proposed:
> os.path.abspath('ast.py', '../../../Python27/lib')
>
> So I would see this as an argument for the proposal rather than against it.
>

Am I the only one who sees this as completely crazy-talk and an argument
against? The idea that os.path.xxx(y,z) could be interpreted as z+y then
resolved is a completely horrible API. The pathlib version keeps the parts
of the path in order, and then resolves them, and where things are, well,
they're clear. The proposed os.path modification reads, to me, as nonsense.
Half of me wants to say it is asking to find the absolute path of ast.py
and find this additional component in relation to that absolute path, the
other half of me just shuts down. "os.path.abspath('ast.py',
'../../../Python27/lib')" speaks in no way to me of absoluteness. There's
two relative paths in its arguments and no sensible way of interpreting
that comes forth, to me.

It may make sense if you were adding a keyword-only argument, maybe,
(maaaybe), but as an example of how they are similar it is IMHO a stark
sign against why its ever so not similar and in fact, bad.

The pathlib version conveys a fairly clear idea of where the files its
talking about are located. The proposal is just weird.

/relurk.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140725/ec08de1d/attachment.html>


More information about the Python-ideas mailing list