killing thread ?

Skip Montanaro skip at pobox.com
Mon Jan 27 10:13:46 EST 2003


    >> All kinds of stuff like process control, file i/o operations, etc.
    >> are OS dependent and Python supports OS specific calls to deal with
    >> those things.  Why on earth should threads have to get a bigger dose
    >> of OS-independence religion than ioctl gets?  This just baffles me.

    Jacob> You have things backwards. Ioctl is a deplorable example of when
    Jacob> OS independence was too hard to achieve. If it can reasonably be
    Jacob> redone in an OS independent way it should. The functionality
    Jacob> itself is way too important to rip out.

It seems to me that the general way platform-dependent stuff is handled is
on a module-by-module basis.  Accordingly, an entire module is either
platform-dependent or platform-independent.  Thus fcntl is Unix-only, as is
win32all.  Once a decision is made that a module will be
platform-independent, it's rare that platform-dependent extensions are made
to it.  That may mean some sacrifice in functionality (e.g., no thread
killing).

The os module is a bit of a weird beast because it provides a hint of
platform independence on top of the posix module and its ilk, but the
programmer must still be careful which module-level objects are used if
concerned about platform independence.  I view this is a compromise.  It
would break too much code to go back now and try to make the os module truly
platform-independent.

Skip






More information about the Python-list mailing list