[Python-Dev] Withdrawn PEP 288 and thoughts on PEP 342

Phillip J. Eby pje at telecommunity.com
Fri Jun 17 17:33:22 CEST 2005


At 11:29 AM 6/17/2005 +0100, Gustavo J. A. M. Carneiro wrote:
>   In conjunction with pseudo-threads, I think a "python main loop"
>implementation is fundamental. Such main loop with permit the programmer
>to  register callbacks for events, such as timeouts, IO conditions, idle
>tasks, etc., such as one found glib (gtk+'s underlying library).  I
>already pointed out one such implementation that I use for one of my
>projects, and it already has unit tests to prove that it works.

I think it's important to point out that such a "main loop" needs to be 
defined as an interface, rather than an implementation, because there are 
many such "main loops" out there as far as GTK, wx, OS X, etc. that have 
different implementation details as to how timeouts and I/O have to be managed.

Since I see from your web page that you've looked at peak.events, I would 
refer you to the IEventLoop interface as an example of such an interface; 
any Twisted reactor can be adapted to provide most of the IEventLoop 
features (and vice versa) which means an interface like it should be usable 
on a variety of platforms.

Of course, I also think that before proposing an event loop facility for 
the stdlib, we should actually succeed in implementing next(arg), yield 
expressions, and throw().  I'll probably take a look at next()/throw() this 
weekend to see if there's anything I can contribute to the ceval.c part; 
I'm a bit less likely to be able to help on the compilation side of things, 
though.  (Apart from maybe adding a POP_TOP after existing yield statements.)



More information about the Python-Dev mailing list