design pattern quick reference proxy proxy py import time class rawclass(object)def func(selfn)return (ndef memoize(fn)__cache {def memoized(*args)key (fn __name__argsif key in __cachereturn __cache[key__cache[keyfn(*argsreturn __cache[keyreturn memoized class classproxy(object)def __init__(selftarget)self target target func getattr(self target'func'setattr(self target'func'memoize(func)def __getattr__(selfname)return getattr(self targetname