u7Fix8
This commit is contained in:
parent
442def2cad
commit
d5fa465a37
@ -72,7 +72,8 @@ class HashTable:
|
||||
|
||||
def __delitem__(self, key):
|
||||
index = self.probe(key)
|
||||
if self.table[index] is not self.empty:
|
||||
if self.table[index] is self.empty or self.table[index] is self.deleted:
|
||||
raise KeyError(key)
|
||||
self.table[index] = self.deleted
|
||||
self.size -= 1
|
||||
|
||||
@ -87,5 +88,5 @@ class HashTable:
|
||||
|
||||
def __iter__(self):
|
||||
for bucket in self.table:
|
||||
if bucket is not self.empty:
|
||||
if bucket is not self.empty and bucket is not self.deleted:
|
||||
yield bucket[0]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user