Are there Python code for a FIFO-like structure?

Huaiyu Zhu hzhu at users.sourceforge.net
Thu Oct 5 19:52:31 EDT 2000


I need something like a fifo, inplemented in a fixed length list, like a
ring.  One can push something into the tail, or pop something from head.
The tail goes around when reaching the end.  There is a specified amount of
buffer between tail and head, and an IndexError is raised if the tail gets
too close to the head.


    tail buffer head
   ,->            |----------.
 /	                      \
 \                            /  


I know it's not too difficult to write, but I'm wondering if it already
exists, or if there is an existing collection of this sort of structures.
(I've checked Vault but didn't see a particularly relevant one.)

-- 
Huaiyu



More information about the Python-list mailing list