Python 2 __getattr__ max recursion depth
<p>for example i use this code:</p>

<pre><code>class A(object):
    def __init__(self):
        self.dict1 = {
            'A': 3,
            'B': self.A}
    def __getattr__(self, key):
        if key in self.dict1:
            return self.dict1[key]
a = A()
</code></pre>

<p>and when it's runned it throws maximum recursion depth exceeded.
Can someone please tell me what am i doing wrong here</p>