Is there any implementation of such a queue in Python which has a fixed length, and when full, pops the left-most element while appending one to the right?
Suppose q = Queue([1,2,3,4,5])
is my queue with a maximum length of 5, and I say q.append(6)
, then expected output for print(q)
should be Queue([2,3,4,5,6])
This question could also be linked to: Is there a fixed sized queue which removes excessive elements?