da2a11adf9
This reverts commit 0494a36681
.
8 lines
217 B
Python
Executable file
8 lines
217 B
Python
Executable file
class CacheDict(dict):
|
|
def __init__(self, func):
|
|
super(CacheDict, self).__init__()
|
|
self.func = func
|
|
|
|
def __missing__(self, key):
|
|
self[key] = value = self.func(key)
|
|
return value
|