3 ms·
I really think they goofed Pathlib because of this. path = Path(“/foo”) / “a” / “b” / “c” The following is functionally equivalent to the above: path
by skinner927 2y ago
I really think they goofed Pathlib because of this.
path = Path(“/foo”) / “a” / “b” / “c”
The following is functionally equivalent to the above:
path = Path(“/foo”) / “a/b/c”
Which I really think was a mistake. The latter should resolve to “/foo/a\/b\/c” (IMO) because all other invalid characters (like space) are auto-escaped. What’s the point of the overloaded div operator otherwise?
- glandium 2y agospace is a valid character in paths. / is not. Never.
- ldjb 2y agoClassic Mac OS used colon (:) as the path separator, so slashes were perfectly acceptable in file and directory names. Even in modern versions of macOS, the GUI still allows you to create files and folders with slashes in their names; the slashes get recorded as colons in the filesystem.