Any other Python flaws?

Mitch Chapman chapman at bioreason.com
Sat Jun 16 17:12:13 EDT 2001


Paul Prescod wrote:
> 
> Mitch Chapman wrote:
> >
> >...
> >
> > I need to manage long-running, parameter-rich computations from
> > GUI applications while still responding to the user.  I think I
> > need threads because they make it easier to exchange all of those
> > parameters between the GUI controller and the background computation
> > than do separate processes.  I think I need processes because I
> > need to be able to cancel the background computation.
> 
> When I need to do something like that I do this:
> 
> while not self._cancel:
>     do_more_computation()

Yep, this is a common approach.  See Xt work procedures,
Gtk+ idle tasks, or even guides to programming in Oberon.  
Unfortunately, this method doesn't work very well when your 
background thread needs to do blocking operations, e.g. reading 
from a socket.

-- 
Mitch Chapman
Mitch.Chapman at bioreason.com



More information about the Python-list mailing list