No, no, no... You DON'T want to know the name of the operating
system.
I challenge you to find a situation where you need to know the name of
the operating system. Usually what you really want to know is
e.g. the pathname separator, or whether a particular module is
provided, or whether particular functionality in a module is provided,
or a particular external program.
You may think that particular funtionality is only available on one
platform, but everybody who used #ifdef SYSV / #ifdef BSD in their
Unix C code found that there are some systems that are neither SYSV
nor BSD -- some systems are hybrid, sometimes it's a compile time
option, sometimes a run-time option, and sometimes it's file-system
dependent!
Python has excellent possibilities to figoure out the availability of
modules (just try to import it and catch the ImportError exception --
or check sys.builtin_module_names, but watch out for dynamically
loaded modules!) and functions (hasattr(module, function)). The
pathname separator and other relevant things are exported by module
'os' (maybe os.path would've been a better place).
External programs are a bit different but then each user's system can
be set up differently so knowing the os name won't be enough anyway...
I have no idea what os.name on the dos windows version is -- I bet
it's 'dos' (like on the basic dos version) because from a Python
program's point of view about the only discernible difference is the
amount of memory available. (Hmm... that would also be a nice
parameter to make available...)
--Guido van Rossum, CWI, Amsterdam <mailto:Guido.van.Rossum@cwi.nl>
<http://www.cwi.nl/cwi/people/Guido.van.Rossum.html>
PS: on NT, os.name is 'nt' (I think :-)