Metaclasses vs. standard Python reflection?
Stephan Diehl
stephan.diehl at gmx.net
Tue May 6 03:51:52 EDT 2003
Dave Benjamin wrote:
> In article <sSIta.82275$K35.2431544 at news2.tin.it>, Alex Martelli wrote:
>> Not really, because THE "key concept" in AOP is that you do
>> this *transversally* with respect to inheritance hierarchies --
>> modifying existing classes (without changing their source code),
>> rather than creating new classes by inheritance, and ACROSS a
>> swathe of classes not necessarily related by inheritance.
>
> Is this the sort of thing you can do with metaclasses? If so, how?
> I feel pretty comfortable with what I know of AOP, but I still feel very
> confused about metaclasses and if/how they propose a solution to this
> problem.
Please have a look at:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/198078
I don't know AOP, so it's probably not an AOP example, but it shows, how you
can change behaviour with a metaclass and not touching the original class
definition.
[...]
More information about the Python-list
mailing list