[issue21537] functools.lru_cache does not cache exceptions

Sviatoslav Sydorenko report at bugs.python.org
Thu Sep 14 05:26:05 EDT 2017


Sviatoslav Sydorenko added the comment:

Hi,

I've got similar need (caching exceptions). My use case is syscall, which is not going to result in something different regardless of the number of times it's called. But I'd like to be able to have exception already raised for me by lru_cache, so that I won't poke kernel with no need.

I'd suggest adding `cache_exceptions=False` key to the decorator to let user control whether it's worth enabling. This might be useful in stdlib.

----------
nosy: +webknjaz

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue21537>
_______________________________________


More information about the Python-bugs-list mailing list