Metaclasses, decorators, and synchronization

Michele Simionato michele.simionato at gmail.com
Tue Sep 27 01:22:56 EDT 2005


Michael Ekstrand ha scritto:
> One issue remains in this function: my method's signature is lost when
> synchronized is applied (at least as somemeth=synchronized(somemeth);
> I'm currently in a 2.3 environment that doesn't have the decorator
> syntax, but my understanding is that makes no difference). I've been
> able to preserve the doc string by setting the __doc__ attribute of the
> inner function before returning it, but is there a way to make this
> inner function appear to bear the same argument list as the original
> method? I've been poking around in new and inspect, but it is not
> appearing like an easy task.

It is not that easy, but you can leverage on my decorator module
which does exactly what you want:
http://www.phyast.pitt.edu/~micheles/python/decorator.zip

 Michele Simionato




More information about the Python-list mailing list