[issue38924] pathlib paths .normalize()

Ionuț Ciocîrlan report at bugs.python.org
Mon Dec 2 13:03:22 EST 2019


Ionuț Ciocîrlan <ionut.ciocirlan at gmail.com> added the comment:

Brett and Serhiy, you do realise there are no symlinks to resolve on PurePaths, right?


> os.path.normpath() is broken by design.

Why don't you deprecate it then? Sounds like the reasonable thing to do, no? So many innocent souls endangered by this evil function...

It's broken by design if you use it to shoot yourself in the foot. If you want however to normalize an abstract path, an absolutely reasonable thing to do, it does the right and very useful thing. Because, well, the filesystem isn't the only thing that has paths and other things don't have symlinks. Also, this lib is called pathlib, not fspathlib, *and* someone had the foresight of separating filesystem paths from abstract paths. Quite a strange series of coincidences, no?

Let me quote the initial comment for this issue, which apparently noone read:

> On `PurePath` its usefulness is obvious, but it's debatable for `Path`, as it would yield different results from `.resolve()` in case of symlinks (which resolves them before normalizing).

----------

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


More information about the Python-bugs-list mailing list