[issue1152248] Add support for reading records with arbitrary separators to the standard IO stack
Christoph Anton Mitterer
report at bugs.python.org
Tue Feb 23 01:04:14 EST 2021
Christoph Anton Mitterer <calestyo at scientia.org> added the comment:
btw, just something for the record:
I think the example given in msg109117 above is wrong:
Depending on the read size it will produce different results, given how split() works:
Imagine a byte sequence:
>>> b"\0foo\0barbaz\0\0abcd".split(b"\0")
[b'', b'foo', b'barbaz', b'', b'abcd']
Now the same sequence, however with a different read size (here a shorter one):
>>> b"\0foo\0barbaz\0".split(b"\0")
[b'', b'foo', b'barbaz', b'']
>>> b"\0abcd".split(b"\0")
[b'', b'abcd']
=> it's the same bytes, but in the 2nd case one get's an extra b''.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue1152248>
_______________________________________
More information about the Python-bugs-list
mailing list