@@ -5,7 +5,7 @@ Discussions-To: https://discuss.python.org/t/42001
55Status: Draft
66Type: Standards Track
77Created: 30-Mar-2014
8- Python-Version: 3.13
8+ Python-Version: 3.15
99Post-History: 30-Mar-2014, 15-Aug-2014, 16-Aug-2014, 07-Jun-2016, 01-Sep-2016,
1010 13-Apr-2021, 03-Nov-2021, 27-Dec-2023
1111
@@ -21,6 +21,8 @@ This PEP proposes small adjustments to the APIs of the ``bytes`` and
2121* Add ``getbyte `` byte retrieval method
2222* Add ``iterbytes `` alternative iterator
2323
24+ The last two (``getbyte `` and ``iterbytes ``) will also be added to ``memoryview ``.
25+
2426Rationale
2527=========
2628
@@ -41,7 +43,7 @@ painful -- wire format protocols.
4143This area of programming is characterized by a mixture of binary data and
4244ASCII compatible segments of text (aka ASCII-encoded text). The addition of
4345the new constructors, methods, and iterators will aid both in writing new
44- wire format code, and in porting any remaining Python 2 wire format code.
46+ wire format code, and in updating existing code.
4547
4648Common use-cases include ``dbf `` and ``pdf `` file formats, ``email ``
4749formats, and ``FTP `` and ``HTTP `` communications, among many others.
@@ -122,8 +124,8 @@ negative numbers. The documentation of the new methods will refer readers to
122124Addition of "getbyte" method to retrieve a single byte
123125------------------------------------------------------
124126
125- This PEP proposes that ``bytes `` and ``bytearray `` gain the method `` getbyte ``
126- which will always return ``bytes ``::
127+ This PEP proposes that ``bytes ``, ``bytearray ``, and `` memoryview `` gain the
128+ method `` getbyte `` which will always return ``bytes ``::
127129
128130 >>> b'abc'.getbyte(0)
129131 b'a'
@@ -139,9 +141,9 @@ If an index is asked for that doesn't exist, ``IndexError`` is raised::
139141Addition of optimised iterator methods that produce ``bytes `` objects
140142---------------------------------------------------------------------
141143
142- This PEP proposes that ``bytes `` and ``bytearray `` gain an optimised
143- ``iterbytes `` method that produces length 1 ``bytes `` objects rather than
144- integers::
144+ This PEP proposes that ``bytes ``, `` bytearray ``, and ``memoryview `` gain an
145+ optimised ``iterbytes `` method that produces length 1 ``bytes `` objects rather
146+ than integers::
145147
146148 for x in data.iterbytes():
147149 # x is a length 1 ``bytes`` object, rather than an integer
@@ -202,13 +204,6 @@ Developers that use this method frequently will instead have the option to
202204define their own ``bchr = bytes.fromint `` aliases.
203205
204206
205- Scope limitation: memoryview
206- ----------------------------
207-
208- Updating ``memoryview `` with the new item retrieval methods is outside the scope
209- of this PEP.
210-
211-
212207References
213208==========
214209
0 commit comments