Skip to content

Commit 548ad51

Browse files
committed
Document mmap object's __iter__ behavior that differs from that of bytearray.
1 parent 1bfe86c commit 548ad51

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Doc/library/mmap.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ byte by doing ``obj[index] = 97``, or change a subsequence by assigning to a
1616
slice: ``obj[i1:i2] = b'...'``. You can also read and write data starting at
1717
the current file position, and :meth:`seek` through the file to different positions.
1818

19+
.. note::
20+
Iterating over a mmap object yields :class:`bytes` objects of length 1; this
21+
differs from :class:`bytearray` which yields class:`int` values in the range
22+
[0, 255].
23+
1924
A memory-mapped file is created by the :class:`~mmap.mmap` constructor, which is
2025
different on Unix and on Windows. In either case you must provide a file
2126
descriptor for a file opened for update. If you wish to map an existing Python

0 commit comments

Comments
 (0)