Windows vs. Linux

D

Dennis Lee Bieber

That is important, but apparently Windows (at least XP) will work fine
with the forward slash that Linux uses. I just tried it in the command
prompt and it works. I'm sure other platforms use the forward slash
separator as well. You've just covered three major platforms (Mac OS X,
WinXP and Linux) without using os.path.join.

System services work with the /

But any operation that passes a path string to a command interpreter
will fail. That means pretty much anything that does os.system(),
spawn*, subprocess module.
And finally, from the Wikipedia entry on Slash (punctuation):
``Note however that the "forward slash" will be translated into a
backslash by most versions of DOS and Windows, in contexts where there
is little ambiguity with command-line options.''
IE, contexts where the is NO command line processing <G>
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
G

Gerhard Fiedler

Ehm... replace that with "the latter with bonk on every OS except
Microsoft Windows". Windows is the weird one in OS-land, because they
are the only one that use the most widely used escape-character (the
backslash) as path separator.

Is that really true? From what I know, it's more like this:

- Unix-type systems: '/'
- Windows-type systems: '\'
- Mac OS: ':'
- OpenVMS: '.'
- ...

Maybe someone else can fill in some of the missing OSes. It doesn't seem to
look like Windows is the odd man out; it rather seems that every type of OS
uses its own separator. (URLs probably use the slash because the internet
protocols have been developed largely on Unix-type systems for use with
Unix-type systems?)

Gerhard
 
S

Sybren Stuvel

Gerhard Fiedler enlightened us with:
- Mac OS: ':'

It's a slash too, at least on non-obsolete Mac OS versions.
Maybe someone else can fill in some of the missing OSes. It doesn't
seem to look like Windows is the odd man out; it rather seems that
every type of OS uses its own separator.

You can put a whole lot of OSses under "Unix-type", but actually it's
more like this:

- FreeBSD: /
- OpenBSD: /
- NetBSD: /
- BSD: /
- Linux: /
- Mac OS X: /
- Solaris: /
- IRIX: /
- SunOS: /
(URLs probably use the slash because the internet protocols have
been developed largely on Unix-type systems for use with Unix-type
systems?)

It wasn't designed specifically for Unix-type systems, but for
universal access.

My point also was that a lot of programming languages use the
backslash as escape character. This has been true at least since the
sixties. I think it's a bad design choice from the Microsoft team to
pick this escape character as a path separator.

Sybren
 
G

Gerhard Fiedler

It's a slash too, at least on non-obsolete Mac OS versions.

I wrote "Mac OS". That's not "Mac OSX". Ask Apple... :) And Mac OSX is
quite arguably a Unix-type system.
You can put a whole lot of OSses under "Unix-type", but actually it's
more like this:

Well, you could list a number of DOS versions, too. Doesn't help the fact
that the slash is mainly on Unix-type systems, and that there are or were
quite a number of other systems out there that use other separator
characters.
It wasn't designed specifically for Unix-type systems, but for universal
access.

Right... the URI/URL syntax was formalized in the early 90ies, when
Unix-type machines were dominant on the internet. There are also quite a
number of concerns that governed the choice of separators and escape
characters for URLs that the IBM, Microsoft and DEC/VMS people couldn't
really foresee in the 70ies (for example, when DEC and IBM started to use
the slash as command line switch character -- which later precluded its use
as path separator).
My point also was that a lot of programming languages use the backslash
as escape character. This has been true at least since the sixties. I
think it's a bad design choice from the Microsoft team to pick this
escape character as a path separator.

Maybe... have you been involved in the decision? Or do you know what the
reasons were? Do you know whether it was even Microsoft's choice?
(Remember, they wrote DOS for IBM. And there was nobody who had foreseen
the PC explosion.)

Did you know that most DOS versions accept the / as path separator? That
DOS was written on Xenix (Posix) systems (using the slash as path
separator)? That Microsoft was for a long time pretty much a pure Xenix
shop?
The problem with the world is stupidity.

Right... And most people are /really/ smart 30 years after the fact; "I
would have known it better" is about as smart as it gets :)

Gerhard
 
D

Dennis Lee Bieber

- OpenVMS: '.'
Well, that should probably be expanded to include

: following a logical or physical device name
[ .* ] for a path on the device
. separate filename from extension
; prefixing file version

Amiga:

: following physical device name, volume label, or logical name
/ for path on the "device"
. convention for file extensions, but not required by OS itself
(Workbench used .info for the file that controlled graphical icons --
but a file named xyz.doc would have the associated file xyz.doc.info;
the extension is not OS controlled)

TRSDOS:
Path was irrelevant, closest one got to paths was using a
partitioned data set utility, in which many small files are stored
within one big file (not an archive format, closer to a library)
/ is the separator between filename and file extension
: after drive name
. prefixing file password, as I recall
(and a $ either before or after, I don't recall, controlled
unbuffered file I/O, with a $ on the other end having another
significance)
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
S

Sybren Stuvel

Gerhard Fiedler enlightened us with:
Right... And most people are /really/ smart 30 years after the fact;
"I would have known it better" is about as smart as it gets :)

I never said "I would have known it better". I just said that IMO it
was a bad design choice ;-)

Sybren
 
G

Gerhard Fiedler

I never said "I would have known it better". I just said that IMO it
was a bad design choice ;-)

Well, and I question your qualification to judge that.

In order to say that, you would have to know the reasoning, would have to
put it in the historical context and would have to be able to explain why
that reasoning was wrong at the time. A design choice is not necessarily a
bad choice just because it turns out that some 30 years later there is a
similar common product whose creators made a different choice, and now
programmers have to cater to both. With the same reasoning one could say
that the Unix creators should have used the VMS (or any other existing)
form.

Gerhard
 
J

John Salerno

Gerhard said:
A design choice is not necessarily a
bad choice just because it turns out that some 30 years later there is a
similar common product whose creators made a different choice, and now
programmers have to cater to both.

To be fair, this isn't the reason he gave for it being a bad design
choice. His reason was that MS chose to use the escape character as
their path separator.

But of course I still agree with you that in either case it's not a
judgment you can fairly make 30 years after the fact.
 
S

Sybren Stuvel

Gerhard Fiedler enlightened us with:
Well, and I question your qualification to judge that.

Just giving my opinion. I'm very qualified to do that.
In order to say that, you would have to know the reasoning, would
have to put it in the historical context and would have to be able
to explain why that reasoning was wrong at the time. A design choice
is not necessarily a bad choice just because it turns out that some
30 years later there is a similar common product whose creators made
a different choice, and now programmers have to cater to both.

But that's not my point. I'm not talking about different path
separators. I'm talking about the fact that they have chosen a common
escape character as path separator. Of course, it's 30 years later
now, and we have quite a different view on things. They still use that
separator, even though they have had 30 years to fix it.
With the same reasoning one could say that the Unix creators should
have used the VMS (or any other existing) form.

No one couldn't, since they didn't use a common escape character.
Please try to understand my point. I'm NOT talking about the
difference in path separators. It would be nice to have uniformity
throughout all systems, but that's not the case.

Sybren
 
S

Sybren Stuvel

John Salerno enlightened us with:
But of course I still agree with you that in either case it's not a
judgment you can fairly make 30 years after the fact.

I don't see Microsoft changing it the next 30 years either... Apple
moved from \r to \n as EOL character. I'm sure the folks at mickeysoft
are smart enough to change from \ to /.

Sybren
 
R

Richard Brodie

With the same reasoning one could say that the Unix creators should have
used the VMS (or any other existing) form.

Only if they used Guido's time machine.
 
B

bryanjugglercryptographer

Sybren said:
John Salerno enlightened us with:

I don't see Microsoft changing it the next 30 years either... Apple
moved from \r to \n as EOL character. I'm sure the folks at mickeysoft
are smart enough to change from \ to /.

They dis-allow '/' in filenames, and many Microsoft products now
respect
'/' as an alternate to '\'.
From a WinXP command prompt:

C:\>
C:\>cd /windows/system32

C:\WINDOWS\system32>


For a "Windows vs. Linux" thread, this one has been remarkably
rant-free.
 
D

Duncan Booth

C:\>
C:\>cd /windows/system32

C:\WINDOWS\system32>
Not from my Windows XP command prompt it doesn't. Do you have anything
strange installed on your system?
 
A

Alex Martelli

...

a few fine points of computing history...:
Right... the URI/URL syntax was formalized in the early 90ies, when

The internet *protocols* were typically developed on non-Unix systems --
that's why each line in text-based protocols must be terminated by
\r+\n, not just \n. The WWW, as you mention, came later (and I believe
it was born on a NEXT cube, i.e., a unix-variant).
Maybe... have you been involved in the decision? Or do you know what the
reasons were? Do you know whether it was even Microsoft's choice?
(Remember, they wrote DOS for IBM. And there was nobody who had foreseen
the PC explosion.)

Microsoft did *NOT* write DOS -- they purchased it from a small Seattle
company, which called it QDOS (Quick and Dirty OS) and had hacked it up
"in desperation" because CP/M did not run on intel 8086 CPUs, so the
small company's main business, selling 8086 boards, languished. QDOS
was as compatible with CP/M as said small company could make it (rumor
has it that big parts were disassembled from CP/M and reassembled to run
on 8086 rather than 8080). Part of the CP/M compatibility did include
the use of / as flag-indicator (the use of \r+\n as line ending also
comes from CP/M -- in turn, CP/M had aped these traits from some DEC
minicomputer operating systems).

When MS did write an OS -- DOS 2.0, which introduced a directory tree --
they did put in the OS an undocumented switch to make - the
flag-indicator and / the path separator, rather than / and \
respectively. However it was never documented and it got removed in
later versions, perhaps because applications coded to the /-and-\
convention could break if the switch was thrown.
Did you know that most DOS versions accept the / as path separator? That
DOS was written on Xenix (Posix) systems (using the slash as path
separator)? That Microsoft was for a long time pretty much a pure Xenix
shop?

Internally yes (indeed, they developed Xenix, before later selling it to
SCO), but that does not mean that "DOS was written on Xenix" because DOS
was *not* written in Microsoft, as above mentioned.


Alex
 
A

Alex Martelli

jean-michel bain-cornu said:
Andy Dingley a écrit :
Don't agree man, it's good for testing...

It's bothersome for testing: virtualization is much handier in most
cases.


Alex
 
J

John Salerno

Sybren said:
Apple
moved from \r to \n as EOL character.

Interesting. I didn't know that. Although it does seem to make sense to
use both \r\n as EOL (if you still consider one as a carriage return and
one as a newline, a la old school typewriters), \n is much nicer and
cleaner looking. :)
 
D

Dennis Lee Bieber

Not from my Windows XP command prompt it doesn't. Do you have anything
strange installed on your system?

Change Directory may work... but

C:\Documents and Settings\Dennis Lee Bieber>cd c:\

C:\>cd /windows/system32

C:\WINDOWS\SYSTEM32>cd c:\

C:\>dir /windows/system32
Parameter format not correct - "windows".

C:\>
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
D

Dennis Lee Bieber

I don't see Microsoft changing it the next 30 years either... Apple
moved from \r to \n as EOL character. I'm sure the folks at mickeysoft
are smart enough to change from \ to /.
Apple also moved from a custom OS to a UNIX-family OS -- the change
in EOL probably resulted as being simpler than modifying all that
out-sourced source code to use the Apple EOL convention.
--
Wulfraed Dennis Lee Bieber KD6MOG
(e-mail address removed) (e-mail address removed)
HTTP://wlfraed.home.netcom.com/
(Bestiaria Support Staff: (e-mail address removed))
HTTP://www.bestiaria.com/
 
G

Gerhard Fiedler

John Salerno enlightened us with:

I don't see Microsoft changing it the next 30 years either... Apple
moved from \r to \n as EOL character.

AFAIK there are few programs from Apple's \r era that still work in the \n
era systems, or am I mistaken with this? :) I also doubt that the line
terminator had any influence in Apple's decision to change their OS. It was
a mere (unintended) side effect, not an objective. If they had chosen a
line terminator, they better had chosen \r\n (the internet email standard).

Unix-type systems still don't use natively the line terminator that is used
in internet email. Windows-type systems do. So when you want to send a text
file stored on a Unix-type system as email, you have to translate the line
terminations (or vice versa). Just as for MS there are good reasons not to
"fix" the backslash now (what would be a good reason to change it?), there
are good reasons for Unix-type system writers to stick with their
traditional \n.


(From a different message)
I'm talking about the fact that they have chosen a common escape
character as path separator.

What's so specifically bad about a "common escape character"? Any character
that has a special meaning in something can be inconvenient when it has to
be used normally. A backslash in a C string, a dot in a regex, you probably
can find examples for any non-alphanumeric ASCII character.

The only "problem" with the backslash is that you need to escape it in C
strings; I never had any trouble with that. BTW, are you really sure that
the backslash was a "common escape character" in the 70ies? How common was
it back then? Even today, it seems to be mostly a C idiom. (In that
respect, Python is leaning on C, even ever so slightly.)


Get over it... there are any number of definitions out there, some better
chosen than others, and most had a good set of reasons at the time they
were chosen. Mostly by chance, some fit better into the picture some
decades later, and some fit less nicely. Without really getting down to it,
there's no way to tell whether any of the standards was well-chosen. Even
the ones that look now as if they were... could be mere luck.

You're of course entitled to your opinion. I never wanted to doubt that.
But an unfounded opinion usually tells more about the subject than the
object... :)

Gerhard
 
G

Gerhard Fiedler

Change Directory may work... but

C:\Documents and Settings\Dennis Lee Bieber>cd c:\

C:\>cd /windows/system32

C:\WINDOWS\SYSTEM32>cd c:\

C:\>dir /windows/system32
Parameter format not correct - "windows".

Since '/' is used as standard command line parameter separator, any command
that uses standard Windows command line parameters can't accept a path with
'/' as argument; it wouldn't know how to differentiate between a path
element and an argument. Try

C:\>dir "/windows/system32"


That was one of the original reasons for using backslashes as path
separator: the existing code base that used the slash as command line
argument separator.

Gerhard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,169
Messages
2,570,920
Members
47,464
Latest member
Bobbylenly

Latest Threads

Top