title: Instance of Python class that responds to all method calls
body: <p>Is there a way to create a class which instances respond to arbitrary method calls? </p>
  
  <p>I know there is a the special method <code>__getattr__(self, attr)</code> which would be called when someone is trying to access an attribute of an instance. I am searching for something similar that enables me to intercept method calls, too. The desired behavior would look something like this:</p>
  
  <pre><code>class A(object):
      def __methodintercept__(self, method, *args, **kwargs): # is there a special method like this??
          print(str(method))
  
  
  &gt;&gt;&gt; a = A()
  &gt;&gt;&gt; a.foomatic()
  foomatic
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>The other suggested questions do not address my case: I do not want to wrap another class or change the metaclass of a second class or similar. I just want to have a class that responds to arbitrary method calls.</p>
  
  <p>Thanks to jonrshape I now know that <code>__getattr__(self, attr)</code> will also be called when a method is called in the same way as it would be when an attribute is accessed. But how do i distinguish in <code>__getattr__</code> if <code>attr</code> comes from a method call or an attribute access and how to get the parameters of a potential method call? </p>