[issue12104] os.path.join('/some/path', '') adds extra slash at end of result

Brian Curtin report at bugs.python.org
Thu May 19 21:45:52 CEST 2011


Brian Curtin <brian at python.org> added the comment:

This is intentional. See the implementation of join in Lib/posixpath.py and the Windows implementation in Lib/ntpath.py which also includes a comment explaining why.

# path is not empty and does not end with a backslash,
# but b is empty; since, e.g., split('a/') produces
# ('a', ''), it's best if join() adds a backslash in
# this case.

----------
nosy: +brian.curtin
resolution:  -> rejected
stage:  -> committed/rejected
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12104>
_______________________________________


More information about the Python-bugs-list mailing list