def __init__(self, write, iterable, memoryBufferSize=None):
"""
Create a _IteratorBuffer.
@param write: A one-argument callable which will be invoked with a list
of strings which have been buffered.
@param iterable: The source of input strings as any iterable.
@param memoryBufferSize: The upper limit on buffered string length,
beyond which the buffer will be flushed to the writer.
"""
self.lines = []
self.write = write
self.iterator = iter(iterable)
if memoryBufferSize is None:
memoryBufferSize = 2 ** 16
self.memoryBufferSize = memoryBufferSize
评论列表
文章目录