[Python-Dev] Re: Revised Proposal: thread.get_dict

Jim Fulton jim at zope.com
Wed Jun 30 15:21:38 EDT 2004


Edward Loper wrote:
> Is this also intended for use as a base class? 

With Amin's latest sugestion, yes.  That is the
real win with his suggestion.

 > In particular, it seems
> like if I have a class Foo, then I can make a thread-local version with 
> the following (as long as Foo doesn't rely on overriding 
> __getattribute__/__setattr__).
> 
>    class LocalFoo(local, Foo): pass
> 
> Is that right?  (I can see how it works in the Python implementation, 
> but don't know enough about extensions to see if that translates 
> directly to the c implementation.)

Yup

> Actually, does local.__init__() need a call to super(self, 
> local).__init__() to make this work?

Init gets pretty weird for thread-local objects.  You sort of
want to run __init__ (if there is one) every time you compute a
dict for a thread.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org



More information about the Python-Dev mailing list