[Twisted-Python] PullProducer appreciation, lack thereof.
Clark C. Evans
cce at clarkevans.com
Wed Apr 2 13:17:53 MST 2003
On Wed, Apr 02, 2003 at 12:56:00PM -0500, Itamar Shtull-Trauring 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.
This is also similar to the 'flow' module by Bob Ippolito (etrepum)
and somewhat distantly related to my flow module; only that mine is
more 'push' like. Both are attempts at bringing an async
producer into play, where the producer could at any time block.
|
| > 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.
Nods.
More information about the Twisted-Python
mailing list