Hooks, aspect-oriented programming, and design by contract

Alex Martelli aleax at aleax.it
Tue Jan 22 10:59:12 EST 2002


"Pedro Rodriguez" <pedro_rodriguez at club-internet.fr> wrote in message
news:pan.2002.01.22.16.08.43.505728.1637 at club-internet.fr...
    ...
> As Alex pointed, 'metaclasses' are maybe the next step. BTW, there are the
> examples in Demo/metaclasses that may help, you'll even find an Eiffel
> class implementation for pre/post conditions.

I also point out that I don't know how to switch metaclasses dynamically,
temporarily and "retroactively" (i.e. so that already-existing instances
are also affected), as requested by the original poster.  I don't even
know if such a metaclass-switch scheme is possible at all.

Note also that the sources in 2.2's Demo\metaclasses are pretty old; I
think that 2.2's innovations make things quite a bit better now (although
the old stuff should keep working).

Still, metaclasses (particularly in 2.2) are no doubt the way to go,
when it's not dynamic/temporary/noninvasive behavior that you are
after, but, rather, some kind of permanent behavior modification.


Alex






More information about the Python-list mailing list