[Tutor] Need to call a custom/magic method on calling of every Class methods

Sunil Tech sunil.techspk at gmail.com
Thu Dec 17 06:48:26 EST 2015


Hi Tutor,

I am searching for any magic method/or any method that calls on every
calling of the Class methods.

for example:

Class A(object):
    def one(self):
        return

    def two(self):
        return

I need a method that prints which method is called in this class.
I am aware of __call__() but this is called only once when the Class is
called
and decorators. This is need to placed on every method.

c = A()
c()  # __call__ method is called.

Is there any magic method that is auto called on every call of these Class
Methods?



Thanks,
Sunil. G


More information about the Tutor mailing list