PEP 3156 / Tulip: Remove 'when' from Handler

Hi, While working on some changes for rose (an eventloop for tulip based on libuv) I realized the Handler class is a bit too coupled to the event loop implementation currently present in Tulip. pyuv (and pyev, and probably others) provide timers already, so there is no need to implement them "manually" and keep a heap with them. This basically means that Handler objects will always have the 'when' value set to None, and the comparison functions don't really apply, moreover __eq__ would even be incorrect in its current form. IMHO it would be good to have a base Handler class which doesn't take time into account and then a Timer class which does. Thoughts? Also, I see that the PEP does mention the possibility of providing a __call__ method on the Handler class itself, which would basically call the callback and suppress exceptions (I guess by logging them). Was this ever discussed? Sounds like a good idea to me :-) Regards, -- Saúl Ibarra Corretgé http://saghul.net/blog | http://about.me/saghul

I think both suggestions are good ones. The when field has bothered me for a while, although it did not come to the surface. Adding the call/catch/log logic on the Handler seems nice too, but I think I would rather not use handler() -- I would rather use handler.call(). I.e. make the method name 'call', not '__call__'. (The latter almost always makes APIs more confusing IMO.) Can you contribute code? --Guido On Tue, Feb 5, 2013 at 6:48 AM, Saúl Ibarra Corretgé <saghul@gmail.com> wrote:
-- --Guido van Rossum (python.org/~guido)

Guido van Rossum wrote:
Sure, I've never used the codereview thing nor mercurial , but I guess this a good time to start :-) -- Saúl Ibarra Corretgé http://saghul.net/blog | http://about.me/saghul

I think both suggestions are good ones. The when field has bothered me for a while, although it did not come to the surface. Adding the call/catch/log logic on the Handler seems nice too, but I think I would rather not use handler() -- I would rather use handler.call(). I.e. make the method name 'call', not '__call__'. (The latter almost always makes APIs more confusing IMO.) Can you contribute code? --Guido On Tue, Feb 5, 2013 at 6:48 AM, Saúl Ibarra Corretgé <saghul@gmail.com> wrote:
-- --Guido van Rossum (python.org/~guido)

Guido van Rossum wrote:
Sure, I've never used the codereview thing nor mercurial , but I guess this a good time to start :-) -- Saúl Ibarra Corretgé http://saghul.net/blog | http://about.me/saghul
participants (2)
-
Guido van Rossum
-
Saúl Ibarra Corretgé