Message236283
| Author |
serhiy.storchaka |
| Recipients |
Henning.von.Bargen, benjamin.peterson, docs@python, martin.panter, pitrou, r.david.murray, serhiy.storchaka |
| Date |
2015年02月20日.13:41:15 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<4482593.HnPrEmWn6J@raxxla> |
| In-reply-to |
<1424437447.92.0.496645779246.issue20699@psf.upfronthosting.co.za> |
| Content |
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. |
|