Python Runtime Method Call Binding

k3xji sumerc at gmail.com
Thu Dec 4 09:23:28 EST 2008


Hi,

Is there a way to hook a function call in python? I know __getattr__
is doing for variables, it is giving us a chance before a field is
initialized. Do we have same functionality for methods?

Example:

class Foo(object):
    def __call_method__(self, ...) # just pseudo
        print 'A method is called in object...'

f = Foo()
f.test_method()

I think you understand my point.

Thanks,



More information about the Python-list mailing list