event loops and Python?

Kragen Sitaker kragen at dnaco.net
Fri Mar 10 18:36:46 EST 2000


What's the state of event-driven Python applications?

I know Tkinter-driven Python programs run from an event loop, but I
don't know what the interface to it is.

Background: I have big mailboxes.  I want to write a mail user agent
that feels snappy on 200MB mailboxes, which is more a matter of maximal
response time than average response time, but involves both.  I want it
to be tty-based.  I want it to do background processing when it's not
responding to me.  And I don't like threads.

So I want an event loop.  
 I want to be able to schedule and unschedule background tasks to be
done when no events are being handled.  
 I want a debugging facility that tells me when a background task takes
more than some nominal amount of time to execute (e.g. 20 ms), so I can
find out which one it was and fix it. 
 I want to be able to handle child process exits as events.  This is
typically difficult to get right in high-level languages that do memory
allocation and such things behind your back, but don't do them in a way
safe to do from signal-handlers.

Am I doomed?  What event-loop does Tkinter use?
-- 
<kragen at pobox.com>       Kragen Sitaker     <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08.  Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
The power didn't go out on 2000-01-01 either.  :)



More information about the Python-list mailing list