Message145570
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. |
|
Date |
User |
Action |
Args |
2011-10-14 22:55:20 | ezio.melotti | set | recipients:
+ ezio.melotti, rhettinger, eric.snow |
2011-10-14 22:55:20 | ezio.melotti | set | messageid: <1318632920.63.0.225615741794.issue13177@psf.upfronthosting.co.za> |
2011-10-14 22:55:20 | ezio.melotti | link | issue13177 messages |
2011-10-14 22:55:19 | ezio.melotti | create | |
|