[Zope-Coders] inheritedAttributes py2.1.3 vs py2.2.3

Shane Hathaway shane@zope.com
Tue, 01 Jul 2003 10:36:23 -0400


alan runyan wrote:
> I was trying to get Acquisition to play nice with threading (the
> production/development boxes are running python2.1.3).  I am
> seeing some unexpected behavior and was just wondering if anyone
> could point me to a mailing list entry that would clarify things.
> 
> code in question:
> 
> class Worker(Acquisition.Implicit, threading.Thread):
>    def __init__(self):
>        Worker.inheritedAttribute('__init__')(self)
>    def run(self):
>        print 'whew!'

I've been using the following pattern.  It seems more reliable and less 
ExtensionClass-specific.

class Worker(Acquisition.Implicit, threading.Thread):
    __base_init = threading.Thread.__init__
    def __init__(self):
        self.__base_init()

Shane