def _get_memoized_value ( func , args , kwargs ) : key = ( repr ( args ) , repr ( kwargs ) ) if not key in func . _cache_dict : ret = func ( * args , * * kwargs ) func . _cache_dict [ key ] = ret return func . _cache_dict [ key ]
python cache value in function
Used internally by memoize decorator to get / store function results
def _get_memoized_value(func, args, kwargs):
    """Used internally by memoize decorator to get/store function results"""
    key = (repr(args), repr(kwargs))

    if not key in func._cache_dict:
        ret = func(*args, **kwargs)
        func._cache_dict[key] = ret

    return func._cache_dict[key]