collect data using threads

James Tanis jtanis at pycoder.org
Tue Jun 14 15:23:10 EDT 2005


Previously, on Jun 14, Peter Hansen said: 

# 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).

What can I say? Lack of sleep.

# 
# 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().

Right, except I'm not writing his code for him, and I don't think he 
expects me too. I was just referring to the existance of a pop() 
function, perhaps I should have said pop([int]) to be clearer. Its use 
would of course have to be tailored to his code depending on what he 
requires.

# 
# 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.

I agree, its been a while and I mixed the two names up, nothing more.

---
James Tanis
jtanis at pycoder.org
http://pycoder.org



More information about the Python-list mailing list