This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author susurrus
Recipients r.david.murray, susurrus
Date 2013-01-30.21:42:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1359582162.47.0.260089116066.issue17083@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-01-30 21:42:42susurrussetrecipients: + susurrus, r.david.murray
2013-01-30 21:42:42susurrussetmessageid: <1359582162.47.0.260089116066.issue17083@psf.upfronthosting.co.za>
2013-01-30 21:42:42susurruslinkissue17083 messages
2013-01-30 21:42:42susurruscreate