A little buffering iterator with one-element rewind.
Methods
|
|
__init__
__iter__
next
rewind
|
|
__init__
|
__init__ (
self,
size,
get_more,
)
Create a _Buffer .
-
size
- the number of items to hold in the buffer at a time.
-
get_more
- a function taking a number as its sole argument;
should return a list of that many new items (or as
many items are left, whichever is less).
|
|
__iter__
|
__iter__ ( self )
|
|
next
|
next ( self )
Returns the next item, refilling the buffer if necessary.
|
|
rewind
|
rewind ( self )
|
|