Skip to content

Commit 4c23865

Browse files
committed
add __getitem__ operator
1 parent 2cfd4ab commit 4c23865

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ True
7979
True
8080
>>> print(bf.query('12'))
8181
False
82+
>>> print(bf['1'])
83+
True
8284
```
8385

8486
### Querying data and at the same time adding it: ###

fastBloomFilter/bloom.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,9 @@ def _query(self, __hash):
269269
self.queryes += 1
270270
return ret
271271

272+
def __getitem__(self, value):
273+
return self.query(value)
274+
272275
def update(self, value):
273276
"""
274277
This function first queryies the filter for a value then adds it.

0 commit comments

Comments
 (0)