On 7/31/2017 7:31 PM, t...@tomforb.es wrote:
As part of the Python 3 cleanup in Django there are a fair few uses of 
@functools.lru_cache on functions that take no arguments.

This makes no sense to me. If the function is being called for side-effects, then it should not be cached. If the function is being called for a result, different for each call, calculated from a changing environment, then it should not be cached. (Input from disk is an example.) If the function returns a random number, or a non-constant value from an oracle (such as a person), it should not be cached. If the function returns a constant (possible calculated once), then the constant should just be bound to a name (which is a form of caching) rather than using the overkill of an lru cache. What possibility am I missing?

--
Terry Jan Reedy

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to