Re: Synchronizing methods of a class

2005-02-09 Thread Keith Veleba
Chris, Q&D example of <>.__dict__.items() not working for me: >>> import threading >>> class A(threading.Thread): ... def __init__(self): ... threading.Thread.__init__(self) ... def one(self): ... pass ... def two(self): ... pass ... >>> a = A() >>>

Re: Synchronizing methods of a class

2005-02-08 Thread Christopher De Vries
On Mon, Feb 07, 2005 at 11:57:02AM -0800, Keith Veleba wrote: > Background: > I'm working on a project where I have to do some serious > multithreading. I've worked up a decorator in Python 2.3.4 to implement > the lock semantics required for specific functions I want to > synchronize: I found Chr

Re: Synchronizing methods of a class

2005-02-08 Thread Diez B. Roggisch
> My Question: > > If I decorate these function references in __class__.__dict__, am I > doing it only for my specific instance of that class or the base class > as well? A class is a class - so yes, all instances are affected. You might want to think about metaclasses for decorating. -- Regards

Synchronizing methods of a class

2005-02-07 Thread Keith Veleba
Hello to all fellow c.l.p'ers! Long-time listener, first-time caller. Background: I'm working on a project where I have to do some serious multithreading. I've worked up a decorator in Python 2.3.4 to implement the lock semantics required for specific functions I want to synchronize: def synchro