Scripting *of* Python

Erik Max Francis max at alcyone.com
Fri Jan 31 04:08:01 CET 2003


Phil Mayers wrote:

> It's a contrived example, but I'm sure you see what I mean - the
> function
> cannot block for very long, so it has to queue itself. This code
> quickly
> gets unreadable (the code it *would* be in a thread is over 1k lines!)
> and
> non-technical (well, less technical) people have to be able to write
> it.

As much as I prefer to recommend this as rarely as possible, it sounds
like a threaded approach might really be in order.  This sounds really
like the case where an asynchronous framework (whether it's Medusa or
Twisted or whatever) is going to be have problems because you need to do
a lot of work in between asynchronous I/O polls, and the only
alternative is breaking the work up into chunks which then makes it much
harder to read, debug, and maintain.

Again, I recommend the use of threads very advisedly, as often they
create more problems than they solve, but this sounds like one of those
(fairly rare) cases where they sound like the right tool for the job.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ The only way to get rid of a temptation is to yield to it.
\__/ Oscar Wilde
    Bosskey.net: Quake III Arena / http://www.bosskey.net/q3a/
 A personal guide to Quake III Arena.




More information about the Python-list mailing list