wrapping all class methods

Mark McEahern marklists at mceahern.com
Fri Nov 15 11:17:11 EST 2002


[Robin Becker]
> What's the 'proper' pythonic way to do this kind of global wrapping?

Hi Robin, I don't know the answer, but I think aspect-oriented programming
provides some ideas.  Pedro Rodriguez has posted working code for doing AOP
to the list:

http://groups.google.com/groups?selm=pan.2002.01.22.15.52.49.832551.1637%40c
lub-internet.fr

Perhaps, if nothing else, Pedro's code may give you some ideas?  I'd be very
interested to hear what you come up with.

What you're trying to do can be done with metaclasses fairly easily--but
that requires (afaik) modifying the modules you want to wrap.  Which makes
it not a very good strategy for AOP (as Pedro has pointed out).  See this
thread:

http://groups.google.com/groups?selm=mailman.1025278420.26105.python-list%40
python.org

Cheers,

// mark

-





More information about the Python-list mailing list