rendered paste bodyclass XtermDict (dict):
RANDOM, ARGS = range(2)
def __getattribute__ (self, key):
attribute = dict.__getattribute__(self, key)
return attribute[XtermDict.ARGS]
def random (self, key):
#assert self.has_key[key]
return self[key][XtermDict.RANDOM]
xtermDict = XtermDict()
xtermDict['foo'] = True, 'Bar'
print xtermDict['foo']
print xtermDict.random('foo')
#################################(True, 'Bar')
Traceback (most recent call last):
File "<stdin>", line 50, in <module>
File "<stdin>", line 42, in __getattribute__
TypeError: 'instancemethod' object is unsubscriptable