MCPcopy Create free account
hub / github.com/ActiveState/code / append

Method append

recipes/Python/68429_Ring_buffer/recipe-68429.py:5–10  ·  view source on GitHub ↗

append an element at the end of the buffer

(self,x)

Source from the content-addressed store, hash-verified

3 self.max = size_max
4 self.data = []
5 def append(self,x):
6 """append an element at the end of the buffer"""
7 self.data.append(x)
8 if len(self.data) == self.max:
9 self.cur=0
10 self.__class__ = RingBufferFull
11 def get(self):
12 """ return a list of elements from the oldest to the newest"""
13 return self.data

Callers 1

recipe-68429.pyFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected