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

Skip Montanaro skip@mojam.com (Skip Montanaro)
Wed, 18 Aug 1999 10:10:41 -0500 (CDT)


    Guido> And the advantage of this would be...?

    Guido> Basically, it seems you're just renaming the functionality of os
    Guido> to posix.

I see a few advantages.

    1. We will get the meaning of the noun "posix" more or less right.
       Programmers coming from other languages are used to thinking of
       programming to a POSIX API or the "POSIX subset of the OS API".
       Witness all the "#ifdef _POSIX" in the header files on my Linux box
       In Python, the exact opposite is true.  Importing the posix module is
       documented to be the non-portable way to interface to Unix platforms.

    2. You would make it clear on all platforms when you expect to be
       programming in a non-portable fashion, by importing the
       platform-specific os (unix, nt, mac).  "import unix" would mean I
       expect this code to only run on Unix machines.  You could argue that
       you are declaring your non-portability by importing the posix module
       today, but to the casual user or to a new Python programmer with a C
       or C++ background, that won't be obvious.

    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.

Skip