[Twisted-Python] When do calls to transport.write() block ?

Itamar Shtull-Trauring itamar at itamarst.org
Tue May 11 12:04:23 EDT 2004


On Tue, 2004-05-11 at 11:49, Stefan Behnel wrote:

> I'm curious though: wouldn't it be much more pythonic to allow users
> to register a generator with the transport? A generator usually does
> exactly what is expected from a pull-producer.

An iterator, you mean. Hmm, because even a pull producer may not have
data on hand, you'd need to have a special object which means "I don't
have data, sorry" that the iterator can return. And you'd still need API
for push producers. OTOH it probably would be more efficient.

What we were thinking of doing is getting rid of the concept of
producers altogether and just exposing "buffers empty and writable" and
"buffers full" callback events similar to dataReceived or
connectionLost.

-- 
Itamar Shtull-Trauring    http://itamarst.org
Looking for a job -- http://itamarst.org/resume.html





More information about the Twisted-Python mailing list