New submission from Barney Gale <barney.g...@gmail.com>:

>>> 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.

----------
components: Library (Lib)
messages: 395122
nosy: barneygale
priority: normal
severity: normal
status: open
title: Support preserving path meaning in os.path.normpath() and abspath()
type: enhancement

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44316>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to