Josh Rosenberg added the comment:
fileinput's semantics are heavily tied to lines, not bytes. And processing
binary files byte by byte is rather inefficient; can you explain why this
feature would be of general utility such that it would be worth including it in
the standard library?
It's not hard to just get a byte at a time using existing parts:
def bytefileinput():
return (bytes((b,)) for line in fileinput.input() for b in line)
There are ways to do similar things without using fileinput at all. But it
really depends on your use case.
Giving fileinput a read() method isn't a bad idea assuming some reasonable
behavior is defined for the various line oriented methods, but making it
iterate binary mode input byte by byte would be a breaking change of limited
utility in my view.
----------
nosy: +josh.rosenberg
_______________________________________
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