[Python-ideas] Updated PEP 428 (pathlib)
Serhiy Storchaka
storchaka at gmail.com
Tue Mar 5 15:58:57 CET 2013
On 05.03.13 09:23, Antoine Pitrou wrote:
> On Tue, 05 Mar 2013 00:33:48 +0100
> Jan Kaliszewski <zuo at chopin.edu.pl> wrote:
>> 1. Ad:
>> >>> PurePosixPath('/usr/bin/python').relative('/etc')
>> Traceback (most recent call last):
>> ...
>> ValueError: ...
>>
>> Shouldn't this particular operation return
>> "PurePosixPath('/etc/../usr/bin/python')"?
>
> Think what happens if /etc is a symlink to /var/etc.
> (not very likely to happen for /etc, but likely to happen in the
> general case)
posixpath.relpath('/usr/bin/python', '/etc') returns
'../usr/bin/python'. Perhaps pathlib should have an option to provide
such compatible behavior.
P.S. Pathlib implementation has relative_to() method. relative() method
exists too but looks as unrelated.
More information about the Python-ideas
mailing list