擅长:python、mysql、java
<p>根据用户1320237的回答,我得到了以下信息。它似乎做了你想做的事。</p>
<pre><code>class A(object):
def __getattribute__(self, attr):
try:
return super(A, self).__getattribute__(attr)
except AttributeError:
self.__setattr__(attr, A())
return super(A, self).__getattribute__(attr)
</code></pre>