[Python-Dev] PEP 467: Minor API improvements to bytes, bytearray, and memoryview
storchaka at gmail.com
Wed Jun 8 01:42:23 EDT 2016
On 07.06.16 23:28, Ethan Furman wrote:
> Minor changes: updated version numbers, add punctuation.
> The current text seems to take into account Guido's last comments.
> Thoughts before asking for acceptance?
> PEP: 467
> Title: Minor API improvements for binary sequences
> Version: $Revision$
> Last-Modified: $Date$
> Author: Nick Coghlan <ncoghlan at gmail.com>
> Status: Draft
> Type: Standards Track
> Content-Type: text/x-rst
> Created: 2014-03-30
> Python-Version: 3.5
> Post-History: 2014-03-30 2014-08-15 2014-08-16
> During the initial development of the Python 3 language specification,
> the core ``bytes`` type for arbitrary binary data started as the mutable
> type that is now referred to as ``bytearray``. Other aspects of
> operating in the binary domain in Python have also evolved over the
> course of the Python 3 series.
> This PEP proposes four small adjustments to the APIs of the ``bytes``,
> ``bytearray`` and ``memoryview`` types to make it easier to operate
> entirely in the binary domain:
> * Deprecate passing single integer values to ``bytes`` and ``bytearray``
> * Add ``bytes.zeros`` and ``bytearray.zeros`` alternative constructors
> * Add ``bytes.byte`` and ``bytearray.byte`` alternative constructors
> * Add ``bytes.iterbytes``, ``bytearray.iterbytes`` and
> ``memoryview.iterbytes`` alternative iterators
"Byte" is an alias to "octet" (8-bit integer) in modern terminology.
Iterating bytes and bytearray already produce bytes. Wouldn't this be
confused? May be name these methods "iterbytestrings", since they adds
More information about the Python-Dev