[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-list
Subject:    Re: collect data using threads
From:       Peter Hansen <peter () engcorp ! com>
Date:       2005-06-14 16:44:32
Message-ID: T-idnTgu08jnlzLfRVn-uA () powergate ! ca
[Download RAW message or body]

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
-- 
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic