Skip to content

Commit 2bee459

Browse files
committed
Mutable _Item
1 parent a1aa631 commit 2bee459

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: data_structures/hashing/hash_map.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
VAL = TypeVar("VAL")
1717

1818

19-
@dataclass(frozen=True, slots=True)
19+
@dataclass(slots=True)
2020
class _Item(Generic[KEY, VAL]):
2121
key: KEY
2222
val: VAL
@@ -81,7 +81,7 @@ def _try_set(self, ind: int, key: KEY, val: VAL) -> bool:
8181
self._len += 1
8282
return True
8383
elif stored.key == key:
84-
self._buckets[ind] = _Item(key, val)
84+
stored.val = val
8585
return True
8686
else:
8787
return False

0 commit comments

Comments
 (0)