Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Doc/library/mmap.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,13 @@ byte by doing ``obj[index] = 97``, or change a subsequence by assigning to a
slice: ``obj[i1:i2] = b'...'``. You can also read and write data starting at
the current file position, and :meth:`seek` through the file to different positions.

.. note::
Iterating over a mmap object yields :class:`bytes` objects of length 1; this
differs from :class:`bytearray` which yields :class:`int` values in the range
[0, 255]. This behavior has been retained for backwards-compatibility. To get
an iterator that iterates over bytes you can create a :class:`memoryview` object
referencing the mmap object.

A memory-mapped file is created by the :class:`~mmap.mmap` constructor, which is
different on Unix and on Windows. In either case you must provide a file
descriptor for a file opened for update. If you wish to map an existing Python
Expand Down
Loading