Raymond Hettinger <rhettin...@users.sourceforge.net> added the comment:

Hello Tim! If you have a chance, please also take a look at issue9685 which I 
was planning to work on in the next couple of weeks.

For memoizing tuple hashes, I'm inclined to think the one extra field is worth 
it.  That would help all the cases where people are concerned about double 
accesses to dicts in a look-before-you-leap pattern or for a pattern of 
fetch-item-update-value-store-new-item.

It looks like the code for collections.OrderedDict() would benefit because it 
does multiple lookups and stores on the same key: 
http://svn.python.org/view/python/branches/release27-maint/Lib/collections.py?revision=84148&view=markup

It would also help the multiple lookups and stores in caching code such as that 
at http://code.activestate.com/recipes/498245-lru-and-lfu-cache-decorators

I suppose we could prepare a patch, instrument it, and try it with Twisted, 
SQLalchemy, and Django to find-out how many tuple hash calculations would be 
saved by memoizing.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9685>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to