Python: How can I get a list of function names from within __getattr__ function?
<p>How can I get the list of class functions from within <code>__getattr__</code> function?</p>

<p>Python v2.7 if it matters.</p>

<p>Trying to use <code>dir</code> within <code>__getattr__</code> leads to infinite recursion.</p>

<pre><code>class Hal(object):
    def __getattr__(self, name):
        print 'I don\'t have a %s function' % name
        names = dir(self) # &lt;-- infinite recursion happens here
        print 'My functions are: %s' % ', '.join(names)
        exit()
    def close_door(self):
        pass
x = Hal()       
x.open_door()
</code></pre>

<p>Here's the output I want:</p>

<pre><code>I don't have a open_door function
My functions are: close_door, __getattr__, __init__, __doc__, ...
</code></pre>

<p>Any other solution which gets me the output I want will work fine.  I want to do fuzzy string matching in the case when a function doesn't exist to try to suggest what the user might have meant.</p>
