[Python-Dev] PEP 467: Minor API improvements for bytes & bytearray

Serhiy Storchaka storchaka at gmail.com
Fri Aug 15 21:54:22 CEST 2014

15.08.14 08:50, Nick Coghlan написав(ла):
> * add bytes.zeros() and bytearray.zeros() as a replacement

b'\0' * n and bytearray(b'\0') * n look good replacements to me. No need 
to learn new method. And it works right now.

> * add bytes.iterbytes(), bytearray.iterbytes() and memoryview.iterbytes()

What are use cases for this? I suppose that main use case may be writing 
the code compatible with 2.7 and 3.x. But in this case you need a 
wrapper (because these types in 2.7 have no the iterbytes() method). And 
how larger would be an advantage of this method over the 
``map(bytes.byte, data)``?

More information about the Python-Dev mailing list