[Python-Dev] Pre-PEP: Task-local variables

Josiah Carlson jcarlson at uci.edu
Thu Oct 20 07:29:18 CEST 2005


"Phillip J. Eby" <pje at telecommunity.com> wrote:
> It's the responsibility of a coroutine scheduler to take a snapshot() when 
> a task is suspended, and to swap() it in when resumed.  So it doesn't 
> matter that you've changed what thread you're running in, as long as you 
> keep the context with the coroutine that "owns" it.
> 
> As I mentioned in the PEP, I don't think that we would bother having 
> Python-defined variables be context-specific until Python 3.0.  This is 
> mainly intended for the kinds of things described in the proposal: ZODB 
> current transaction, current database connection, decimal context, 
> etc.  Basically, anything that you'd have a thread-local for now, and 
> indeed most anything that you'd use a global variable and 'with:' for.
> 
> I don't see how that's even related.  This is simply a replacement for 
> thread-local variables that allows you to also be compatible with 
> "lightweight" (coroutine-based) threads.

I just re-read the proposal with your clarifications in mind.  Looks
good.  +1

 - Josiah



More information about the Python-Dev mailing list