asynchat sends data on async_chat.push and .push_with_producer

ludvig.ericson at gmail.com ludvig.ericson at gmail.com
Tue May 13 12:35:14 EDT 2008


> In a pure world, the only writing that is done would be within the
> handle_send() callbacks within the select loop.  Then again, in a
> perfect world, calling readable() and writable() would have no strange
> side affects (as your example below has), and all push*() calls would
> be made within the handle_*() methods.

It wouldn't have those side-effects if push really just pushed. :-P

> We do not live in a pure world, Python isn't pure (practicality beats
> purity), and by attempting to send some data each time a .push*()
> method is called, there are measurable increases in transfer rates.

-- 8< --

> Yes, it would be convenient to not have push*() actually send data
> when called in some cases, but in others, the increase in data
> transfer rates and/or reduction in latency is substantial.

If it increases transfer speed that much, the calling application
almost has to be broken, or at least not designed as it should be - of
course there are such applications, but you know...

Anyway, I went for a subclassing way of dealing with it, and it works
fine.

Thanks for the reply though, hadn't considered possibly "flawed"
applications where the asyncore loop isn't revisited as often as it
should. :->
Ludvig



More information about the Python-list mailing list