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 <rep...@bugs.python.org>
<http://bugs.python.org/issue20699>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to