New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Minor documentation bug with os.path.split #51074
Comments
The documentation for os.path.split says, in part: "In nearly all cases, join(head, tail) equals path (the only But this is not quite true: that's not the *only* exception, at least This can also happen if os.altsep is used in the path being split, in >>> 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 |
how about "an equivalent path" instead of "equal path"? The result of ntpath.join(ntpath.split(path)) should point to the same location even if it isn't literally the same string. |
Hello, Regards, |
Hah, I totally forgot about this thing. I'd suggest a change to the proposed patch. The patched version says: "In nearly all cases, Except now the parenthetical remark at the end of that sentence is a bit weird, because "a//a" != "a/a" is no longer an exception. I'd suggest a wording such as one of the following, depending on where you want the emphasis (on the meaning of the return value of a path or on the actual contents of the return value as a string): "In all cases, "In most cases, The first suggestion could be followed by a remark "(but the strings may be unequal)" if you'd like. I'd also replace "a location equivalent to" with "a path to the same location as" or something like that; "location" doesn't appear anywhere else on that page, and it seems slightly out of place to me. |
Hi Evan, I decided to go with the first option and adding a note about the possible different strings. Regards, |
Thanks, applied in r85453. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: