mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 10:10:46 +00:00
utils/misc: document memoized limitation
Document the issue with using memoized with mutable types.
This commit is contained in:
parent
94c1339efd
commit
a3c04fc140
@ -648,7 +648,15 @@ def __get_memo_id(obj):
|
|||||||
|
|
||||||
@wrapt.decorator
|
@wrapt.decorator
|
||||||
def memoized(wrapped, instance, args, kwargs): # pylint: disable=unused-argument
|
def memoized(wrapped, instance, args, kwargs): # pylint: disable=unused-argument
|
||||||
"""A decorator for memoizing functions and methods."""
|
"""
|
||||||
|
A decorator for memoizing functions and methods.
|
||||||
|
|
||||||
|
.. warning:: this may not detect changes to mutable types. As long as the
|
||||||
|
memoized function was used with an object as an argument
|
||||||
|
before, the cached result will be returned, even if the
|
||||||
|
structure of the object (e.g. a list) has changed in the mean time.
|
||||||
|
|
||||||
|
"""
|
||||||
func_id = repr(wrapped)
|
func_id = repr(wrapped)
|
||||||
|
|
||||||
def memoize_wrapper(*args, **kwargs):
|
def memoize_wrapper(*args, **kwargs):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user