1
2
3
4
5 """ limited list """
6
7 __copyright__ = 'this file is in the public domain'
8
10
11 """ list with limited number of items """
12
16
17 - def insert(self, index, item):
18 """ insert item at index .. pop oldest item if limit is reached """
19 if index > len(self):
20 return -1
21 if len(self) >= self.limit:
22 self.pop(len(self)-1)
23 list.insert(self, index, item)
24
26 """ add item to list .. pop oldest item if limit is reached """
27 if len(self) >= self.limit:
28 self.pop(0)
29 list.append(self, item)
30