axiak / pybloomfiltermmap

Fast Python Bloom Filter using Mmap
http://axiak.github.com/pybloomfiltermmap/
MIT License
741 stars 137 forks source link

Reset __len__ after bf.clear_all() #77

Open jbrockmendel opened 7 years ago

jbrockmendel commented 7 years ago

I expected that after bf.clear_all() calling len(bf) would give 0. It looks like it isn't being re-set.

>>> bf = pybloomfilter.BloomFilter(100, .01)
>>> silent = bf.add('foo')
>>>  len(bf)
1
>>> bf.clear_all()
>>> len(bf)
1

I'm getting this for both in-memory and file-based filters, on Ubuntu and OSX. Python 2.7 in each case.

mizvyt commented 4 years ago

I've confirmed this issue exists in pybloomfiltermmap3 as well. See https://github.com/prashnts/pybloomfiltermmap3/issues/27