AOP and metaclasses
Shalabh Chaturvedi
shalabh at cafepy.com
Fri Feb 20 16:36:12 EST 2004
Santiago Aguiar wrote:
> I know its possible to apply an aspect to all the classes by
> redefining __metaclass__, and that I can do the same with a single
> class by assigning to __metaclass__ inside the class definition.
> However, I want to avoid the last step, so i can apply the aspect to
> any class.
If one class has a __metaclass__ inside its definition, its subclasses will
use the same metaclass (unless they have another __metaclass__ in their
defintion). So you could define one class and use it as a base for the
specific classes that you want to affect.
--
Shalabh
More information about the Python-list
mailing list