Author cbay
Recipients cbay, giampaolo.rodola, janssen, pitrou, r.david.murray, vstinner
Date 2010-03-30.16:43:19
SpamBayes Score 0.00378623
Marked as misclassified No
Message-id <1269967401.36.0.387374361347.issue8240@psf.upfronthosting.co.za>
In-reply-to
Content
> Hmm, indeed. What you can do, very simply, is cache the getvalue()
> result once you have generated it.

After some thoughts, it's not really an option: my cStringIO.StringIO buffer is, well a buffer. To append data to the buffer, I call buffer.write(). When I've got a chance to send data over the socket (remember, it's async, so I don't really know when it's going to happen), I call buffer.getvalue().

If socket.write() returns zero byte written, I'll have to wait until I get another chance to send my buffer. But in the meantime, some more data might get appended to the buffer, and the string returned by getvalue() will be different from the first call (and thus, I can't really cache it).

I could find some tricks (like using multiple buffers), but it would be ugly.
History
Date User Action Args
2010-03-30 16:43:21cbaysetrecipients: + cbay, janssen, pitrou, vstinner, giampaolo.rodola, r.david.murray
2010-03-30 16:43:21cbaysetmessageid: <1269967401.36.0.387374361347.issue8240@psf.upfronthosting.co.za>
2010-03-30 16:43:19cbaylinkissue8240 messages
2010-03-30 16:43:19cbaycreate