Skip: > Also, should the behavior be > consistent across platforms or should it do what is correct for each > platform on which it's implemented (dospath, ntpath, macpath)? Obviously it should do what's correct for each platform, although more than one thing can be correct for a given platform -- e.g Unix doesn't care whether there's a trailing slash on a pathname. In the Unix case it's probably less surprising if the trailing slash is removed, because it's redundant. The "broken" code referred to in the original message highlights another problem, however: there is no platform-independent way provided to remove a prefix from a pathname, given the prefix as returned by one of the other platform-independent path munging functions. So maybe there should be an os.path.removeprefix(prefix, path) function. While we're on the subject, another thing that's missing is a platform-independent way of dealing with the notion of "up one directory". Greg Ewing, Computer Science Dept, +--------------------------------------+ University of Canterbury, | A citizen of NewZealandCorp, a | Christchurch, New Zealand | wholly-owned subsidiary of USA Inc. | greg@cosc.canterbury.ac.nz +--------------------------------------+
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4