[Python-Dev] Portable and OS-dependent module idea/proposal/brain fart

Tim Peters tim_one@email.msn.com
Sat, 21 Aug 1999 04:09:17 -0400


[Skip Montanaro]
> ...
> 3. If Dan Connolly's contention is correct, importing the os module
>    today is not all that portable.  I can't really say one way or the
>    other, because I'm lucky enough to be able to confine my serious
>    programming to Unix.  I'm sure there's someone out there that
>    can try the following on a few platforms:
>
> 	  import os
> 	  dir(os)
>
>    and compare the output.

There's no need to, Skip.  Just read the os module docs; where a function
says, e.g., "Availability: Unix.", it doesn't show up on a Windows or Mac
box.

In that sense using (some) os functions is certainly unportable.  But I have
no sympathy for the phrasing of Dan's complaint:  if he calls os.getegid(),
*he* knows perfectly well that's a Unix-specific function, and expressing
outrage over it not working on NT is disingenuous.

OTOH, I don't think you're going to find anything in the OS module
documented as available only on Windows or only on Macs, and some
semi-portable functions (notoriosly chmod) are documented in ways that make
sense only to Unixheads.  This certainly gives a strong impression of
Unix-centricity to non-Unix weenies, and has got to baffle true newbies
completely.

So 'twould be nice to have a basic os module all of whose functions "run
everywhere", whose interfaces aren't copies of cryptic old Unixisms, and
whose docs are platform neutral.

If Guido is right that the os functions tend to get more portable over time,
fine, that module can grow over time too.  In the meantime, life would be
easier for everyone except Python's implementers.