[issue36485] Establish a uniform way to clear all caches in a given module
Raymond Hettinger
report at bugs.python.org
Mon Apr 1 21:05:33 EDT 2019
Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:
Quick question, would the existing sys.reload() logic suffice?
-- mymodule.py --
cache = {} # On reload, this would clear the cache
def f(x):
if x in cache:
return cache[x]
y = x**2
cache[x] = y
return y
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36485>
_______________________________________
More information about the Python-bugs-list
mailing list