def memoize_single_arg(f):
memo = {}<EOL>@wraps(f)<EOL>def memoized_f(arg):<EOL><INDENT>try:<EOL><INDENT>return memo[arg]<EOL><DEDENT>except KeyError:<EOL><INDENT>result = memo[arg] = f(arg)<EOL>return result<EOL><DEDENT><DEDENT>return memoized_f<EOL>
Decorator memoizing a single-argument function