ascv / HyperLogLog

Fast HyperLogLog for Python.
MIT License
99 stars 19 forks source link

Add type, bounds, and value checking to set_registers() #37

Closed ascv closed 4 years ago

ascv commented 4 years ago
import HLL

h = HLL.HyperLogLog(3)
b = bytearray(8)
b[0] = 1
b[7] = 1

print('Using bytearray')
h.set_registers(b)
print(map(int, h.registers()))

print('Using bytes')
b[1] = 1
b[6] = 1
h.set_registers(bytes(b))
print(map(int, h.registers()))

# 2.7.x ValueError, 3.x TypeError 
h.set_registers('aaaaaaaa')