New submission from Ezio Melotti <ezio.melo...@gmail.com>: The attached patch changes lru_cache to use if/else instead of try/except. This has 2 effects: 1) it avoids chained exceptions and makes the error messages clearer; 2) it probably makes lru_cache a bit faster since building and catching exceptions is expensive. It also gets rid of the KeyError=KeyError optimization/hack;
For a couple of examples of 1) see #12749 (msg142059, msg142063), or #13169 (msg145469). See also related issue #6210. ---------- assignee: rhettinger files: issue13177.diff keywords: needs review, patch messages: 145511 nosy: ezio.melotti, rhettinger priority: normal severity: normal stage: patch review status: open title: Avoid chained exceptions in lru_cache type: behavior versions: Python 3.2, Python 3.3 Added file: http://bugs.python.org/file23403/issue13177.diff _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue13177> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com