[Python-Dev] Re: [Stackless] comments on PEP 219

Jeremy Hylton jeremy at alum.mit.edu
Wed Mar 14 02:17:39 CET 2001

>>>>> "GMcM" == Gordon McMillan <gmcm at hypernet.com> writes:

  >> Is this the semantic difference between Stackless and CPython
  >> that people are getting all in a lather about?

  GMcM> What semantic difference? You can't transfer control to a
  GMcM> coroutine / urthread in a magic method in CPython, either
  GMcM> <wink>.

If I have a library or class that uses threads under the covers, I can
create the threads in whatever code block I want, regardless of what
is on the call stack above the block.  The reason that coroutines /
uthreads are different is that the semantics of control transfers are
tied to what the call stack looks like a) when the thread is created
and b) when a control transfer is attempted.

This restriction seems quite at odds with modularity.  (Could I import
a module that creates a thread within an __init__ method?)  The
correctness of a library or class depends on the entire call chain
involved in its use.

It's not at all modular, because a programmer could make a local
decision about organizing a particular module and cause errors in a
module that don't even use directly.  This would occur if module A
uses uthreads, module B is a client of module A, and the user writes a
program that uses module B.  He unsuspectingly adds a call to module A
in an __init__ method and *boom*.


"Python is a language in which the use of uthreads in a module you
didn't know existed can render your own program unusable."  <wink>
Stackless mailing list
Stackless at starship.python.net

More information about the Stackless mailing list