Apologies for the long subject line, here it is again: "Pep 342 (val = yield MyGenerator(foo)), synchronous os.system() that doesn't block gui event loops"
On Jul 21, 7:48 pm, John Nagle <na...@animats.com> wrote: > > The idea: > > > To run functions that execute a series of system commands without > > blocking the ui, *and* without adding state machine logic. > > At some level, there's going to be state machine logic. > You need interlocking so that the user can't initiate > simultaneous conflicting background operations from the GUI. This belongs to the "I don't care" category, as you'd expect to have only one operation like this on the flight at one time. The idea is to allow making simple scripts that you execute from the gui, that *may* need to access the gui objects at one point or another (so execution has to happen in the main thread most of the time - apart from blocking, long operations). > The usual solution is to run the background operations > in another thread, and have them put events on a queue > read by the GUI task. Yeah, and the receiving end of the "queue" here would be the same block of statements that launched the request - that is, I want to avoid having to create handler functions, and keep the program from linear. > You also have to work out how to cancel background operations, > if they're going to be as big as a "make". I think that is easy to accomplish with generators, provided that you can let the long-lasting operation run to completion - just close() the generator. If the long lasting computation was in a subprocess, rather than a thread, it could be interrupted in a cleaner fashion even. -- http://mail.python.org/mailman/listinfo/python-list