[Twisted-Python] PullProducer appreciation, lack thereof.

Itamar Shtull-Trauring itamar at itamarst.org
Wed Apr 2 12:56:00 EST 2003


On 02 Apr 2003 09:25:04 -0800
Kevin Turner <acapnotic at twistedmatrix.com> wrote:

> On Mon, 2003-03-24 at 14:29, radix CVS wrote: 
> > class IPullProducer(IProducer):
> >     """A pull producer, also known as a non-streaming producer, is
> >     expected to produce data each time resumeProducing() is called.
> >     """
> >     def resumeProducing(self):
> >         """Resume producing data.
> >         This tells a producer to re-add itself to the main loop and
> >         produce more data for its consumer."""
> 
> Usage and behaviour of a PullProducer isn't clear to me.  Does
> PullProducer.resumeProducing mean that it should call consumer.write
> exactly once?

Yes.

> If it is a different interface, can we give the method a different
> name?  I think it strange that you call "resume" on these when
> producing has never been "paused".  And that "resume" in this case
> does not signal a return to an ongoing process from which it has been
> interrupted, but is a single  request for a discrete amount of data. 
> A name beginning with "get" or "next" seems more fitting.

Yes, but it's there for historical reasons...

Idon't think the two interfaces should be merged - they are different in
intent and usage.

-- 
Itamar Shtull-Trauring    http://itamarst.org/
http://www.zoteca.com -- Python & Twisted consulting




More information about the Twisted-Python mailing list