Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 7427a23

Browse files
authoredOct 25, 2024··
Trying to solve pre-commit error of type overload
1 parent f9ddbfb commit 7427a23

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

‎data_structures/arrays/dynamic_array.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ def get(self, index: int) -> int:
7878
if index < 0 or index >= self.size:
7979
raise IndexError("index out of range")
8080
return self.array[index]
81+
82+
def __setitem__(self, index: int, value: int) -> None:
83+
if index < 0 or index >= self.size:
84+
raise IndexError("index out of range")
85+
self.array[index] = value
8186

8287
def __len__(self) -> int:
8388
"""

0 commit comments

Comments
 (0)
Please sign in to comment.