execute a function before and after any method of a parent class
michele.simionato at gmail.com
Tue Oct 7 15:34:44 CEST 2008
On Oct 3, 9:23 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:
> Ok, but then you have to explicitely decorate every method. To avoid this,
> you may use a metaclass; this article by Michael Foord explains how:http://www.voidspace.org.uk/python/articles/metaclasses.shtml#a-metho...
Since Python 2.6 is out, I would recommend using a class decorator for
The class decorator is not inherited, so in order to decorate methods
one has to repeat it, which I see as a feature (explicit is better
Otherwise the readers of your classes will not have any visual clue
magic is going on; moreover, you will lower the risk of decorating
that should not be decorated (I mean, in case of accidents).
More information about the Python-list