On Sat, 10 Aug 2019 at 00:36, Steven D'Aprano <steve@pearwood.info> wrote:
2. To strongly discourage newbie Windows developers from hard-coding paths using backslashes, but to use forward slashes instead.
(Side issue) As a Windows developer, who has seen far too many cases where use of slashes in filenames implies a Unix-based developer not thinking sufficiently about Windows compatibility, or where it leads to people hard coding '/' rather than using os.sep (or better, pathlib), I strongly object to this characterisation. Rather, I would simply say "to make Windows users more aware of the clash in usage between backslashes in filenames and backslashes as string escapes". There are *many* valid ways to write Windows pathnames in your code: 1. Raw strings 2. Doubling the backslashes 3. Using pathlib (possibly with slash as a directory separator, where it's explicitly noted as a portable option) 4. Using slashes IMO, using slashes is the *worst* of these. But this latter is a matter of opinion - I've no objection to others believing differently, but I *do* object to slashes being presented as the only option, or the recommended option without qualification. Paul