Are there Python code for a FIFO-like structure?

Aahz Maruch aahz at panix.com
Thu Oct 5 23:25:43 EDT 2000


In article <slrn8tq5d2.21q.hzhu at rocket.knowledgetrack.com>,
Huaiyu Zhu <hzhu at users.sourceforge.net> wrote:
>
>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.

You could probably subclass the Queue module, but that would only make
sense if you were already writing a threaded application.
-- 
                      --- Aahz (Copyright 2000 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

There's a difference between a person who gets shit zie doesn't
deserve and a person who gets more shit than zie deserves.  --Aahz



More information about the Python-list mailing list