Not fully understanding the role of Queue.task_done()

Fredrik Lundh fredrik at pythonware.com
Sun Sep 7 10:34:59 EDT 2008


Aahz wrote:

>> why are you using a queue for this case, btw?  why not just use a plain list
>>
>>     L = []
>>     lock = threading.Lock()
>>
>> and add stuff using append in the monitor threads
>>
>>     with lock:
>>         L.append(item)
> 
> Because using a queue requires less thinking.

given that the whole reason for this thread was that Queue API didn't 
fit the OP:s problem, that's a rather dubious statement.

(btw, I've always thought that Python was all about making it easy to 
express the solution to a given problem in code, not to let you write 
programs without using your brain.  when did that change?)

</F>




More information about the Python-list mailing list