continuous return?

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Nov 3 22:31:34 EST 2009


En Wed, 04 Nov 2009 00:20:05 -0300, Someone Something  
<fordhaivat at gmail.com> escribió:

> I'm trying to write something related to IRC. The thing is, I have one
> thread receiving and another sending. But, how can I keep the caller of  
> the
> recv() function informed about what was last received so that it can all  
> be
> printed out. But, I no idea how I can accomplish this. I was thinking  
> about
> getting one variable that was constantly updated with the latest line  
> that
> was recved and that the variable would be  a member of the class so other
> functions/classes can access it

I don't completely understand your scenario, but since you say you have  
several threads, a common way to communicate between them is to use a  
Queue object. Let the receiver thread put() lines into the queue, and the  
processing thread get() them and do some work.

-- 
Gabriel Genellina




More information about the Python-list mailing list