Author vstinner
Recipients bolorsociedad, rhettinger, vstinner
Date 2018-11-23.12:15:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1542975329.95.0.788709270274.issue35300@psf.upfronthosting.co.za>
In-reply-to
Content
> 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
History
Date User Action Args
2018-11-23 12:15:30vstinnersetrecipients: + vstinner, rhettinger, bolorsociedad
2018-11-23 12:15:29vstinnersetmessageid: <1542975329.95.0.788709270274.issue35300@psf.upfronthosting.co.za>
2018-11-23 12:15:29vstinnerlinkissue35300 messages
2018-11-23 12:15:29vstinnercreate