This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ezio.melotti
Recipients eric.snow, ezio.melotti, rhettinger
Date 2011-10-14.22:55:19
SpamBayes Score 5.5136542e-08
Marked as misclassified No
Message-id <1318632920.63.0.225615741794.issue13177@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2011-10-14 22:55:20ezio.melottisetrecipients: + ezio.melotti, rhettinger, eric.snow
2011-10-14 22:55:20ezio.melottisetmessageid: <1318632920.63.0.225615741794.issue13177@psf.upfronthosting.co.za>
2011-10-14 22:55:20ezio.melottilinkissue13177 messages
2011-10-14 22:55:19ezio.melotticreate