#NEWLINE# def memoize( func ) : #NEWLINE# #INDENT# saved = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# def call( * args ) : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# return saved [ args ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# res = func ( * args ) #NEWLINE# saved [ args ] = res #NEWLINE# return res #NEWLINE# #UNINDENT# except TypeError : #NEWLINE# #INDENT# return func ( * args ) #NEWLINE# #UNINDENT# #UNINDENT# call . __name__ = call . __name__ #NEWLINE# return call