[Tutor] reading files in Python 3
eryk sun
eryksun at gmail.com
Fri Mar 31 16:42:06 EDT 2017
On Thu, Mar 30, 2017 at 8:45 PM, Mats Wichmann <mats at wichmann.us> wrote:
> Yeah, fun. You need to escape the \ that the idiot MS-DOS people chose
> for the file path separator. Because \ is treated as an escape character.
The COMMAND.COM shell inherited command-line switches (options) that
use slash from TOPS-10 by way of CP/M, so using backslash in paths was
less ambiguous for the shell (e.g. dir/w could be intended to run "w"
in the "dir" subdirectory, or it could mean to run "dir" with the
option "/w"). The DOS kernel did support both slash and backslash in
file-system paths.
Also, C wasn't a common language on the PC back then. BASIC was.
Instead of using escapes in string literals, BASIC used addition at
runtime with the CHR$ function or predefined constants. Support for
hierarchical paths (DOS 2.0) came around at about the same time that C
was rising in popularity, so the pain came on slowly like boiling a
lobster.
The system designers who really have no excuse are the NT kernel
developers circa 1988-93. They were working in C on a system that
already required converting paths from the DOS namespace to a native
object namespace. They could have easily implemented the native object
system to use slash instead of backslash.
More information about the Tutor
mailing list