[issue38924] pathlib paths .normalize()

Vedran Čačić report at bugs.python.org
Fri Nov 29 02:23:34 EST 2019


Vedran Čačić <vedgar at gmail.com> added the comment:

I think the real issue here

> mypath = PurePosixPath(normpath(mypath))

is the PurePosixPath wrapper. It is nice that normpath _accepts_ pathlike objects, but it should then not return a generic str. It should try to return an object of the same type.

Of course it's harder to do, especially in presence of pathlike objects of unknown classes, but with some reasonable assumptions on the constructors, it can be done---and it's much more useful. The similar debate, with similar conclusions, has already happened with datetime-like objects.

----------
nosy: +veky

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38924>
_______________________________________


More information about the Python-bugs-list mailing list