Message395122
>>> os.path.normpath('a/./b/../c//.')
'a/c'
>>> pathlib.Path('a/./b/../c//.')
PosixPath('a/b/../c')
pathlib takes care not to change the meaning of the path when normalising. That means preserving '..' entries, as these can't be simplified without resolving symlinks etc.
normpath(), on the other handle, /always/ eliminates '..' entries, which can change the meaning of the path.
We could add a new argument to `normpath()` and `abspath()` that leaves '..' entries intact. This was closed as "won't fix" back in bpo-2289, but I think it's worth re-considering.
This enhancement would be helpful for my longer-term work to make pathlib an OOP wrapper of os + os.path, rather than a parallel implementation. |
|
Date |
User |
Action |
Args |
2021-06-04 21:21:19 | barneygale | set | recipients:
+ barneygale |
2021-06-04 21:21:19 | barneygale | set | messageid: <1622841679.24.0.579072106292.issue44316@roundup.psfhosted.org> |
2021-06-04 21:21:19 | barneygale | link | issue44316 messages |
2021-06-04 21:21:19 | barneygale | create | |
|