[issue20992] reading individual bytes of multiple binary files using the Python module fileinput

Tommy Carstensen report at bugs.python.org
Mon Mar 24 23:32:04 CET 2014


Tommy Carstensen added the comment:

I read the fileinput code and realized how heavily tied it is to line input.

Will reading individual bytes as suggested not be very memory intensive, if each line is billions of characters?

    def bytefileinput():
        return (bytes((b,)) for line in fileinput.input() for b in line)

I posted my workaround on stackoverflow (see link earlier in tread), which does not make use of the fileinput module at all. After having read through the fileinput code I agree that the module should only support reading lines and this enhancement request should be closed.

----------
resolution:  -> rejected
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20992>
_______________________________________


More information about the Python-bugs-list mailing list