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

Jeremy Hylton jeremy@alum.mit.edu
Tue, 13 Mar 2001 13:30:37 -0500 (EST)


>>>>> "BR" == Bernd Rinn <Bernd.Rinn@epost.de> writes:

  BR> On Tue, Mar 13, 2001 at 12:17:39PM -0500, Gordon McMillan wrote:
  >> The one instance I can find on the Stackless list (of attempting
  >> to use a continuation across interpreter invocations) was a call
  >> the uthread.wait() in __init__. Arguably a (minor) nuisance,
  >> arguably bad coding practice (even if it worked).

[explanation of code practice that lead to error omitted]

  BR> So I suspect that you might end up with a rule of thumb:

  BR> """ Don't use classes and libraries that use classes when doing
  BR> IO in microthreaded programs!  """

  BR> which might indeed be a problem. Am I overlooking something
  BR> fundamental here?

Thanks for asking this question in a clear and direct way.

A few other variations on the question come to mind:

    If a programmer uses a library implement via coroutines, can she
    call library methods from an __xxx__ method?

    Can coroutines or microthreads co-exist with callbacks invoked by
    C extensions? 

    Can a program do any microthread IO in an __call__ method?

If any of these are the sort "in theory" problems that the PEP alludes
to, then we need a full spec for what is and is not allowed.  It
doesn't make sense to tell programmers to follow unspecified
"reasonable" programming practices.

Jeremy