diff options
author | Antoine Pitrou <solipsis@pitrou.net> | 2010-09-15 11:25:11 (GMT) |
---|---|---|
committer | Antoine Pitrou <solipsis@pitrou.net> | 2010-09-15 11:25:11 (GMT) |
commit | 25d535ea6a443f467eacfc9f487c90120972ca7f (patch) | |
tree | 23feb014181a59162d9044813d8d562aee6885b6 /Doc/library/mmap.rst | |
parent | ecbf2dea367b8dd971ccf4f3e3814afbb9ed5af9 (diff) | |
download | cpython-25d535ea6a443f467eacfc9f487c90120972ca7f.zip cpython-25d535ea6a443f467eacfc9f487c90120972ca7f.tar.gz cpython-25d535ea6a443f467eacfc9f487c90120972ca7f.tar.bz2 |
Merged revisions 84827-84829 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r84827 | antoine.pitrou | 2010-09-15 11:58:26 +0200 (mer., 15 sept. 2010) | 3 lines
Add a glossary entry for file objects.
........
r84828 | antoine.pitrou | 2010-09-15 12:08:31 +0200 (mer., 15 sept. 2010) | 3 lines
Update file-related information in the FAQ.
........
r84829 | antoine.pitrou | 2010-09-15 13:11:28 +0200 (mer., 15 sept. 2010) | 3 lines
Add cross-references to the glossary entry for file objects.
........
Diffstat (limited to 'Doc/library/mmap.rst')
-rw-r--r-- | Doc/library/mmap.rst | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/Doc/library/mmap.rst b/Doc/library/mmap.rst index 403e2f5..bb4a515 100644 --- a/Doc/library/mmap.rst +++ b/Doc/library/mmap.rst @@ -5,14 +5,13 @@ :synopsis: Interface to memory-mapped files for Unix and Windows. -Memory-mapped file objects behave like both :class:`bytes` and like file -objects. Unlike normal :class:`bytes` objects, however, these are mutable. -You can use mmap objects in most places where :class:`bytes` are expected; for -example, you can use the :mod:`re` module to search through a memory-mapped file. -Since they're mutable, you can change a single 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. +Memory-mapped file objects behave like both :class:`bytearray` and like +:term:`file objects <file object>`. You can use mmap objects in most places +where :class:`bytearray` are expected; for example, you can use the :mod:`re` +module to search through a memory-mapped file. You can also change a single +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. A memory-mapped file is created by the :class:`mmap` constructor, which is different on Unix and on Windows. In either case you must provide a file |