Terry J. Reedy added the comment:

Posted today on python-ideas with the mistaken title "os.path.argparse - 
optional startdir argument" by Wolfgang Maier (wolma). (He corrected in a 
second post, but too late.)  Juancarlo AƱez pointed to pathlib.Path.resolve as 
a better alternative. Path joins and resolve combines the functions of 
os.path.abspath and os.path.normpath with a nicer syntax, and with OS awareness.

>>> p.Path('../../../Python27/lib', 'ast.py').resolve()
WindowsPath('C:/Programs/Python27/Lib/ast.py')

If one starts with a base Path, one can use '/' to join.

>>> base = p.Path('.')
>>> (base / '../../../Python27/lib' / 'ast.py').resolve()
WindowsPath('C:/Programs/Python27/Lib/ast.py')

In light of the above, I agree with Serhiy that this issue should be closed 
unless there is a surge of approval for the proposal.

----------
nosy: +terry.reedy
status: pending -> open
versions: +Python 3.5 -Python 3.2

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

Reply via email to