Josh Rosenberg added the comment:
On memory: Yeah, it could be if the file didn't include any newline characters.
Same problem could apply if a text input file relied on word wrap in an editor
and included very few or no newlines itself.
There are non-fileinput ways of doing this, like I said; if you want consistent
performance, you'd probably use one of them. For example, using the two arg
form of iter:
from functools import partial
def bytefileinput(files):
for file in files:
with open(filename, "rb") as f:
yield from iter(partial(f.read, 1), b'')
Still kind of slow, but predictable on memory usage and not to complex.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue20992>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com