The Python Way

Gustavo Cordova gcordova at hebmex.com
Wed Mar 27 16:00:08 EST 2002


> Thinking of automatic locking concepts, has there been a PEP for 
> synchronized objects like Java?
> 
>     class Snorf:
>         def __init__(self):
>             self.lock = lock.lock()
> 
>         def doSomething(self,x) synchronize(self.lock):
>             code
> 
> It would be nice if the synchronize parameter could be an instance, 
> class or module lock.

Hmmm... I believe this would be easy to do using metaclasses,
but since I'm no meta-wizard, I'll leave it to one of the
great bots to illuminate us with a simple proof of concept.

-gustavo




More information about the Python-list mailing list