Ezio Melotti <ezio.melo...@gmail.com> added the comment: Canceling the chained exception might work as a workaround, but it requires yet another try/except and it's not very elegant in my opinion.
Raymond, about __missing__ it shouldn't be a problem here, because we are using "in" to look in the cache, and the cache is either a dict or an OrderedDict and they don't use __missing__. I also did some crude benchmark using strings (see attached file): always hit try: 0.3375518321990967 in : 0.43109583854675293 always miss try: 2.7987680435180664 in : 0.3211240768432617 5 hit, 5 miss try: 18.37925887107849 in : 5.305108070373535 9 hit, 1 miss try: 8.38001799583435 in : 6.524656057357788 Of course this will change if the hash() function gets more expensive, or if the ratio hits:miss is different. ---------- Added file: http://bugs.python.org/file23412/issue13177-bench.py _______________________________________ 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