Launch file in Notepad

Grant Edwards grante at visi.com
Thu May 12 11:34:39 EDT 2005


On 2005-05-12, Bengt Richter <bokr at oz.net> wrote:

>>> There are several ways, but the preferred solution is to switch the 
>>> slash direction: "c:/test.txt". Python's smart enough to notice its 
>>> running on Windows and do the right thing with the slash.
>>
>>Does Python really look at the string and mess with the slash?
>>I don't think it needs to, since the Windows system calls have
>>always accepted forward slashses, haven't they?
>
> For a path parameter, I think so. But various command shells us '/' the
> way unix uses '-' -- i.e., for options/switches. E.g.

You're right.  It's the applications that choke on the forward
slash.  Back in the bad old days there was a way to tell DOS to
use '-' for the switch character, but not all apps paid
attention to the setting.

> I don't know why MS used backslashes when unix had a perfectly
> good path syntax (not to mention drive letter idiocy). Maybe
> some legal idiocy, wanting to be different to be safe from SCO
> types?

I think the use of forward slashes for command line switches
was adopted by CP/M from DEC's OSes (e.g. RSX-11).  CP/M didn't
have directories in the beginning, so nobody worried about what
to use for path separators (DEC used colons, IIRC).  DOS was a
straight-up ripoff of CP/M and kept '/' as the option
character.  Later when directories were added to DOS, they
picked '\' as the path seperator becuase '/' was the default
switch caracter.  The C-language "system calls" always accepted
either, but they may have been translating forward to backward
before making the DOS call calls.

-- 
Grant Edwards                   grante             Yow!  .. If I had heart
                                  at               failure right now,
                               visi.com            I couldn't be a more
                                                   fortunate man!!



More information about the Python-list mailing list