Jason R. Coombs added the comment:

Indeed. I guess my point about "supported" related to not having tests 
capturing this requirement or docs stipulating it.

My instinct on the latter question is this - an lru_cache-decorated function is 
a stateful function. It is mutable, much like a dict or list. If simply copied, 
the resulting function should have references to the same state. If _deep_ 
copied, the state (cache) should be similarly deep copied.

Focusing on the deep copy operation, if a cached function is copied, the copy 
could have additional operations invoked on it and its cache would hit or miss 
on those calls independently from the original function, and likewise 
subsequent calls on the original function should not hit on calls unique to the 
copied function.

I don't have a heavy investment in this expectation. It's also reasonable to me 
that a deepcopy operation could reuse the same cache or result in an 
uninitialized one.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue25447>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to