Message180994
| 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:42 | susurrus | set | recipients:
+ susurrus, r.david.murray |
| 2013年01月30日 21:42:42 | susurrus | set | messageid: <1359582162.47.0.260089116066.issue17083@psf.upfronthosting.co.za> |
| 2013年01月30日 21:42:42 | susurrus | link | issue17083 messages |
| 2013年01月30日 21:42:42 | susurrus | create |
|