Non-recursive, 8-bit block table lookup version:

def ham(a, b, ht=[hamdist(a,0) for a in range(256)]):
    x = a ^ b
    dist = 0
    while x:
        dist += ht[x & 255]
        x >>= 8
    return dist

Raymond


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to