STINNER Victor <vstin...@redhat.com> added the comment:
> When the returned mutable object is modified, the cache is modified as well. > In my opinion, functools.lru_cache should store a deep copy of the returned > object. It would be inefficient to deep copy the mutable result and can defeat the purpose of the cache... I would rather to add a note to the documentation to explain to either not return mutable objects or to not modify them :-) https://docs.python.org/dev/library/functools.html#functools.lru_cache ---------- nosy: +rhettinger, vstinner _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue35300> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com