We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1262f36 commit 7ada7ddCopy full SHA for 7ada7dd
ring_buffer/ring_buffer.py
@@ -5,7 +5,11 @@ def __init__(self, capacity):
5
self.storage = [None]*capacity
6
7
def append(self, item):
8
- pass
+ self.storage[self.current] = item
9
+ if self.current >= len(self.storage)-1:
10
+ self.current = 0
11
+ else:
12
+ self.current += 1
13
14
def get(self):
15
+ return [v for v in self.storage if v is not None]
0 commit comments