Prevent a method from being called if it is incorrect using __getattr__
<p>I am trying to prevent an instance from throwing an exception if a method that does not exist for the instance is called. I have tried the following:</p>

<pre><code>class myClass(object):
    def __init__(self):
        pass
    def __getattr__(self,name):
        print "Warning - method {0} does not exist for this instance".format(name)

o = myClass()
var = o.someNonExistantFunction()
</code></pre>

<p>The problem is that I get the following error:</p>

<pre><code>TypeError: 'NoneType' object is not callable
</code></pre>

<p>The two things I want to make sure of doing is:</p>

<ol>
<li>Return <code>None</code> as my code can deal with variables being set to <code>None</code></li>
<li>Perform a function (printing a warning message)</li>
</ol>

<p>What is the cleanest way to do this?</p>
