\nclass UpperClassTwit(object):\n def __getattribute__(self, name):\n print 'trying %r.%s' % (self, name)\n try:\n parrot = object.__getattribute__(self, name)\n except:\n print 'not found: %r.%s' % (self, name)\n return self.hidey_ho\n\n return parrot\n\n def hidey_ho(self):\n print 'oog'\n\nf = UpperClassTwit()\n\nf.garble()\n
Running this yields:
\n>>> ## working on region in file /usr/tmp/python-1260iBu...\ntrying <__main__.UpperClassTwit object at 0x81de63c>.garble\nnot found: <__main__.UpperClassTwit object at 0x81de63c>.garble\ntrying <__main__.UpperClassTwit object at 0x81de63c>.hidey_ho\noog\n>>> \n