collect data using threads

Peter Hansen peter at engcorp.com
Tue Jun 14 12:44:32 EDT 2005


James Tanis wrote:
> I may be wrong here, but shouldn't you just use a stack, or in other 
> words, use the list as a stack and just pop the data off the top. I 
> believe there is a method pop() already supplied for you. 

Just a note on terminology here.  I believe the word "stack" generally 
refers to a LIFO (last-in first-out) structure, not what the OP needs 
which is a FIFO (first-in first-out).

Assuming you would refer to the .append() operation as "putting data on 
the bottom", then to pop off the "top" you would use pop(0), not just 
pop().

Normally though, I think one would refer to these as the head and tail 
(not top and bottom), and probably call the whole thing a queue, rather 
than a stack.

-Peter



More information about the Python-list mailing list