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

Tim Peters tim_one@email.msn.com
Tue, 24 Aug 1999 02:32:49 -0400


[Fred L. Drake, Jr.]
>   Actually, the spawn*() functions are included in os and are
> documented as Windows-only, along with the related P_* constants.
> These are provided by the nt module.

I stand corrected, Fred -- so how do the Unix dweebs like this Windows crap
cluttering "their" docs <wink>?

[Tim, pitching a portable sane interface to a portable sane subset of
 os functionality]

>   I'm alwasy glad to see documentation patches, or even pointers to
> specific problems.  Being a Unix-weenie myself, making the
> documentation more readable to Windows-weenies can be difficult at
> times.  But given useful pointers, I can usually pull it off, or at
> least drive someone who canto do so.  ;-)

No, it's deeper than that.  Some of the inherited Unix interfaces are flatly
incomprehensible to anyone other than a Unix-head, but the functionality is
supplied only in that form (docs may ease the pain, but the interfaces still
suck); for example,

    mkdir (path[, mode])
    Create a directory named path with numeric mode mode.
    The default mode is 0777 (octal). On some systems, mode
    is ignored. Where it is used, the current umask value is
    first masked out. Availability: Macintosh, Unix, Windows.

If you have a sister or parent or 3-year-old child (they're all equivalent for
this purpose <wink>), just imagine them reading that.  If you can't, I'll have
my sister call you <wink>.  Raw numeric permission modes, octal mode notation,
and the "umask" business are Unix-specific -- and even Unices supply symbolic
ways to specify permissions.

chmod is likely the one I hear the most gripes about.  Windows heads are
looking to change "file attributes", the name "chmod" is gibberish to them,
most of the Unix mode bits make no sense under Windows (& contra Guido's
optimism, never will) even if you know the secret octal code, and Windows has
several attributes (hidden bit, system bit, archive bit) chmod can't get at.
The only portable functionality here is the write bit, but no non-Unix person
could possibly guess either that chmod is the function they need, or what to
type after someone tells them it's chmod.

So this is less a doc issue than that more of os needs to become more like
os.path (i.e., intelligently named functions with intelligently abstracted
interfaces).

never-grasped-what-ken-thompson-had-against-trailing-"e"s-ly y'rs  - tim