Skip to content

Commit 6c84f1e

Browse files
committed
docs/speed_python: Clarify/generalize "Buffers" subsection.
1 parent f474e95 commit 6c84f1e

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

docs/reference/speed_python.rst

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,10 @@ An example of the above is the common case where a buffer is required, such as o
5959
used for communication with a device. A typical driver will create the buffer in the
6060
constructor and use it in its I/O methods which will be called repeatedly.
6161

62-
The MicroPython libraries typically provide optional support for pre-allocated buffers.
63-
For example the ``uart.readinto()`` method allows two options for its argument, an integer
64-
or a buffer. If an integer is supplied it will read up to that number of bytes and
65-
return the outcome: this implies that a buffer is created with a corresponding
66-
memory allocation. Providing a pre-allocated buffer as the argument avoids this. See
67-
the code fragment in :ref:`Caching object references <Caching>` below.
62+
The MicroPython libraries typically provide support for pre-allocated buffers. For
63+
example, objects which support stream interface (e.g., file or UART) provide ``read()``
64+
method which allocate new buffer for read data, but also a ``readinto()`` method
65+
to read data into an existing buffer.
6866

6967
Floating Point
7068
~~~~~~~~~~~~~~

0 commit comments

Comments
 (0)