wxPython and threads again

David E. Konerding DSD staff dek at scooby.lbl.gov
Thu Aug 11 11:56:30 EDT 2005


On 2005-08-10, Bryan Olson <fakeaddress at nowhere.org> wrote:
> > The easiest approach, though, is to use the threadedselectreactor in 
> Twisted (you need
> > to check the HEAD branch out with subversion, because that reactor 
> isn't included in any releases).
> > With threadedselectreactor, it's easy to incorporate both the GUI 
> event loop and the twisted reactor.
> > Twisted already includes lots of code for doing asynchronous 
> callback-style IO for
> > IO bound processes like downloading.  Further, you don't even think 
> in an explicitly threaded way-
> > createing a whole thread just to manage a download process which is 
> motly IO and a little bookkeeping is
> > silly.  Twisted's approach just makes a lot more sense and simplifies 
> the code too.
>
> I couldn't disagree more about that being easier and simplifying
> the code. "Creating a whole thread" is trivial.
>
>

I've done both styles.  Actually, I greatly prefer the single threaded approach now; conceptually,
the threaded approach is very simple, but your program ends up getting complex because the data-passing
infrastructure.  And you end up structuring your logic in somewhat more convoluted ways.  And
most people have such a hard time dealing with data synch between threads...

Dave



More information about the Python-list mailing list