[Python-checkins] cpython (3.4): #22613: explain what "buffer" is in the struct documentation (thanks Jacques
georg.brandl
python-checkins at python.org
Fri Oct 31 10:39:46 CET 2014
https://hg.python.org/cpython/rev/5faee3db42a7
changeset: 93307:5faee3db42a7
branch: 3.4
user: Georg Brandl <georg at python.org>
date: Fri Oct 31 09:46:41 2014 +0100
summary:
#22613: explain what "buffer" is in the struct documentation (thanks Jacques Ducasse)
files:
Doc/library/struct.rst | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/Doc/library/struct.rst b/Doc/library/struct.rst
--- a/Doc/library/struct.rst
+++ b/Doc/library/struct.rst
@@ -24,6 +24,14 @@
or omit implicit pad bytes, use ``standard`` size and alignment instead of
``native`` size and alignment: see :ref:`struct-alignment` for details.
+Several :mod:`struct` functions (and methods of :class:`Struct`) take a *buffer*
+argument. This refers to objects that implement the :ref:`bufferobjects` and
+provide either a readable or read-writable buffer. The most common types used
+for that purpose are :class:`bytes` and :class:`bytearray`, but many other types
+that can be viewed as an array of bytes implement the buffer protocol, so that
+they can be read/filled without additional copying from a :class:`bytes` object.
+
+
Functions and Exceptions
------------------------
@@ -47,7 +55,7 @@
Pack the values *v1*, *v2*, ... according to the format string *fmt* and
write the packed bytes into the writable buffer *buffer* starting at
- position *offset*. Note that *offset* is a required argument.
+ position *offset*. Note that *offset* is a required argument.
.. function:: unpack(fmt, buffer)
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list