Message214758
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. |
|
Date |
User |
Action |
Args |
2014-03-24 23:18:06 | josh.r | set | recipients:
+ josh.r, Tommy.Carstensen |
2014-03-24 23:18:06 | josh.r | set | messageid: <1395703086.66.0.158862152923.issue20992@psf.upfronthosting.co.za> |
2014-03-24 23:18:06 | josh.r | link | issue20992 messages |
2014-03-24 23:18:06 | josh.r | create | |
|