Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Buffer:
- def __init__(self):
- self.b = list()
- def add(self, *a):
- self.b.extend(a)
- print(sum(self.b[-5:]))
- def get_current_part(self):
- return self.b
- buf = Buffer()
- buf.add(1, 2, 3)
- buf.get_current_part()
- buf.add(4, 5, 6)
- buf.get_current_part()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement