RingBuffer.py 220 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
class RingBuffer:
    def __init__(self, size):
        self.data = [None for i in range(size)]

    def append(self, x):
        self.data.pop(0)
        self.data.append(x)

    def get(self):
Arne Gerdes's avatar
Arne Gerdes committed
10
        return self.data