while block:
    block = file.read(block_size)
items = block.split(delim)
for i in range(len(items) - 1):
    item = items[i]
if last_item:
    yield last_item + item
last_item = ''
continue
if item:
    yield item
last_item += items[-1]
Pythonic way to iterate through a file on something other than newlines