[issue6825] Minor documentation bug with os.path.split

Evan Driscoll report at bugs.python.org
Wed Sep 2 22:35:24 CEST 2009


New submission from Evan Driscoll <evaned at gmail.com>:

The documentation for os.path.split says, in part:

  "In nearly all cases, join(head, tail) equals path (the only 
  exception being when there were multiple slashes separating head
  from tail)."

But this is not quite true: that's not the *only* exception, at least
without a somewhat liberal definition of "equals".

This can also happen if os.altsep is used in the path being split, in
which case it will be replaced by os.sep:

>>> import ntpath
>>> path = "a/b"
>>> (head, tail) = ntpath.split(path)
>>> joined = ntpath.join(head, tail)
>>> joined == path
False
>>> joined
'a\\b'


[I only selected the versions that I actually verified, but I would
guess it's present in more.]

----------
assignee: georg.brandl
components: Documentation
messages: 92180
nosy: evaned, georg.brandl
severity: normal
status: open
title: Minor documentation bug with os.path.split
versions: Python 2.6, Python 2.7, Python 3.1

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


More information about the Python-bugs-list mailing list