[issue23756] Tighten definition of bytes-like objects
Serhiy Storchaka
report at bugs.python.org
Tue Mar 24 10:20:16 CET 2015
Serhiy Storchaka added the comment:
Totally agree. Current definition is too wide. Actually in different places the term "bytes-like object" can imply different requirements.
* Supports buffer protocol. list isn't.
* Contiguous. memoryview()[::2] isn't.
* len() returns bytes size. array('I') isn't.
* Supported indexing (and slicing) of bytes. array('I') isn't.
* Indexing returns integers in the range 0-255. array('b') isn't.
* Supports concatenation. memoryview isn't.
* Supports common bytes and bytearray methods, such as find() or lower().
* A subclass of (bytes, bytearray).
* A subclass of bytes.
* A bytes itself.
----------
nosy: +r.david.murray, serhiy.storchaka
versions: +Python 3.4, Python 3.5
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue23756>
_______________________________________
More information about the Python-bugs-list
mailing list