Catching all methods before they execute

jamesthiele.usenet at jamesthiele.usenet at
Mon Mar 7 19:15:27 CET 2005

I have run into some cases where I would like to run a class method
anytime any class method is invoked.
That is, if I write

then it will be the same as writing

for any method in class x (with the possible exception of 'bar').

The first few times I wanted to print out a data structure for
debugging purposes. Most recently it was to save a data structure to
allow "undo" operations. I've realized that this is a generalized
problem and I was hoping that someone could point me to the correct
hook to accomplish this (python seems to have a hook for everything).

More information about the Python-list mailing list