[issue13177] Avoid chained exceptions in lru_cache

Raymond Hettinger report at bugs.python.org
Fri Oct 14 16:00:40 CEST 2011


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

This changes behavior so that hash() gets called twice for the key tuple, resulting in decreased performance.

In an earlier version of the lru_cache before the "with lock" was introduced, the try/except form was more atomic.  It also worked well with dict subclasses that use __missing__ (which is bypassed with the LBYL style of lookup).

I'll look at this more shortly -- thanks for the links to the other tracker items.

----------
priority: normal -> low

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13177>
_______________________________________


More information about the Python-bugs-list mailing list