Bryant added the comment:

I'm not terribly worried about the "right" way for me to deal with my code, but 
that Python, in this instance, is inconsistent. While it doesn't want you to 
apply the concept of a "line" to a binary file in that it prevents you from 
specifying an EOL string, it does allow you to read that file as lines.

So my question is why shouldn't I be able to specify a newline of b"\r\n" and 
then use readline() on my binary file? I don't see why that concept shouldn't 
be applied here when it's definitely applicable in a lot of cases (any binary 
log format).

To resolve this I really think there're two options to maintain the consistency 
of Python's approach:
 1) Have readline() error out for binary-mode files.
 2) Allow specifying a byte-string as the newline string for binary files that 
readline() would then use.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue17083>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to