forked from jaybaird/python-bloomfilter
-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
The following sample code has been executed on both python 2 and python 3 with the same result
from pybloom_live import BloomFilter
if __name__ == '__main__':
bf1 = BloomFilter(capacity=1000, error_rate=0.001)
bf2 = BloomFilter(capacity=1000, error_rate=0.001)
bf1.add(1)
bf1.add(2)
print("Test 1 in bf1: " + str(1 in bf1))
print("Test 2 in bf1: " + str(2 in bf1))
with open("/tmp/bloomTest.txt", "wb") as fp:
bf1.tofile(fp)
with open("/tmp/bloomTest.txt", "rb") as fp2:
bf2.fromfile(fp2)
print("Test 1 in bf2: " + str(1 in bf2))
print("Test 2 in bf2: " + str(2 in bf2))
Output:
Test 1 in bf1: True
Test 2 in bf1: True
Test 1 in bf2: False
Test 2 in bf2: False
Metadata
Metadata
Assignees
Labels
No labels