[docs] [issue20699] Document that binary IO classes work with bytes-likes objects
Serhiy Storchaka
report at bugs.python.org
Fri Feb 20 14:41:16 CET 2015
Serhiy Storchaka added the comment:
Because it is not len(b). I fixed several bugs in Python code which called
len() for bytes-like argument and failed with array.array or memoryview with
non-byte items.
The term "bytes-like object" is slightly misleading. In some cases it implies
indexing and len, and iterating, and may be slicing -- common operations for
bytes, bytearray, array('B'), memoryview().cast('B'). In more narrow meaning
it may require such operations as concatenation (operator +) and .startswith()
-- common for bytes and bytearray. In more general meaning it requires only
the support of buffer protocol and contiguity. In more general meaning it may
be even non-contiguous.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue20699>
_______________________________________
More information about the docs
mailing list