On Sat, Mar 20, 2010 at 3:17 PM, Case Vanhorsen <cas...@gmail.com> wrote: > On Sat, Mar 20, 2010 at 4:06 AM, Mark Dickinson <dicki...@gmail.com> wrote: >> What external modules are there that rely on existing hash behaviour? > > I'm only aware of  gmpy and SAGE. > >> And exactly what behaviour do they rely on? > > Instead of calculating hash(long(mpz)), they calculate hash(mpz) > directly. It avoids creation of a temporary object that could be quite > large and is faster than the two-step process. I would need to modify > the code so that it continues to produce the same result.
Does gmpy only do this for Python 2.6? Or does it use different algorithms for 2.4/2.5 and 2.6? As far as I can tell, there was no reasonable way to compute long_hash directly at all before the algorithm was changed for 2.6, unless you imitate exactly what Python was doing (break up into 15-bit pieces, and do all the rotation and addition exactly the same way), in which case you might as well be calling long_hash directly. Mark _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com