File size: 372 Bytes
079c32c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
from queue import LifoQueue
from collections import deque
class LifoDeque(LifoQueue):
"""
Overview:
Like LifoQueue, but automatically replaces the oldest data when the queue is full.
Interfaces:
``_init``, ``_put``, ``_get``
"""
def _init(self, maxsize):
self.maxsize = maxsize + 1
self.queue = deque(maxlen=maxsize)
|