def freshdefaults(f):
    "wrap f and keep its default values fresh between calls"
    fdefaults = f.func_defaults
    def refresher(*args, **kwds):
        f.func_defaults = deepcopy(fdefaults)
        return f(*args, **kwds)
    return refresher
wrap f and keep its default values fresh between calls
recipes/Python/303440_Fresh_function_defaults/recipe-303440.py