[SciPy-User] Smart Hashing of Integer Numbers

nicky van foreest vanforeest at gmail.com
Thu Sep 24 16:56:15 EDT 2009


Sorry...and thanks again Robert.  I forgot to add the .data to the key.

This really works.

#!/usr/bin/env python

from numpy import *

index = {}

ar = [ [2,3], [5,4]]

for a in ar:
    key = array(a, dtype=uint8)
    key.flags.writeable = False
    index[key.data] = len(index)

for data in index:
    dum = frombuffer(data,dtype=uint8)
    print dum



More information about the SciPy-User mailing list