yield buf[:pos]
buf = buf[pos + len(newline):]
chunk = f.read(4096)
if not chunk:
    yield buf
break
buf += chunk
with open('file') as f:
    for line in myreadlines(f, '.'):
        pass
Reading a file with a specified delimiter for newline