[issue43620] os.path.join does not use os.sep as documentation claims

Jared Sutton report at bugs.python.org
Thu Mar 25 21:03:32 EDT 2021


Jared Sutton <jpsutton at gmail.com> added the comment:

> Perhaps Jared was expecting that modifying os.sep would affect the functions in os.path?

This is precisely what I thought, because the documentation makes it sound like that variable named os.sep is read and used as the path delimiter when constructing something with join(). In fact, that variable isn't read *at all* because the path separator is hard-coded in both posixpath.py and ntpath.py. Since os.sep isn't used, I see no reason why it should be referenced in the documentation at all.

I'm not trying to be pedantic here (though we nerds are famous for that :) ), but what I see here is a disagreement between what is documented and what actually exists in the implementation. Yes the *value* of os.sep happens to be the same as the one hard-coded into either ntpath or posixpath, but since that variable is not referenced in the implementation, its presence in the doc only serves to confuse people who take the documentation at face value and then get an unexpected result.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43620>
_______________________________________


More information about the Python-bugs-list mailing list