from joblib import Memory memory = Memory() @memory.cache(ignore=['verbose']) def f(x, verbose=0): if verbose > 0: print('Running f(x).') return x