Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0adfb45

Browse files
committed
Make changes and clarifications suggested by Mark Hammond
1 parent b081e18 commit 0adfb45

1 file changed

Lines changed: 23 additions & 14 deletions

File tree

Doc/lib/libmmap.tex

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,24 @@ \section{\module{mmap} ---
1919

2020
\begin{funcdesc}{mmap}{fileno, length \optional{, tagname} }
2121
(Windows version) Maps \var{length} bytes from the file specified by
22-
the file handle \var{fileno}, and returns a mmap object. If you have
23-
a Python file object, its
24-
\method{fileno()} method returns the file's handle, which is just an integer.
25-
\var{tagname}, if specified, is a string giving a tag name for the mapping. XXX what is the purpose of the tag name?
22+
the file handle \var{fileno}, and returns a mmap object. If you wish
23+
to map an existing Python file object, use its \method{fileno()}
24+
method to obtain the correct value for the \var{fileno} parameter.
25+
26+
\var{tagname}, if specified, is a string giving a tag name for the mapping.
27+
Windows allows you to have many different mappings against the same
28+
file. If you specify the name of an existing tag, that tag is opened,
29+
otherwise a new tag of this name is created. If this parameter is
30+
None, the mapping is created without a name. Avoiding the use of the
31+
tag parameter will assist in keeping your code portable between Unix
32+
and Windows.
2633
\end{funcdesc}
2734

28-
\begin{funcdesc}{mmap}{file, size \optional{, flags, prot}}
35+
\begin{funcdesc}{mmap}{fileno, size \optional{, flags, prot}}
2936
(Unix version) Maps \var{length} bytes from the file specified by the
30-
file handle \var{fileno}, and returns a mmap object. If you have a
31-
Python file object, its \method{fileno()} method returns the file's
32-
handle, which is just an integer.
37+
file handle \var{fileno}, and returns a mmap object. If you wish to
38+
map an existing Python file object, use its \method{fileno()} method
39+
to obtain the correct value for the \var{fileno} parameter.
3340

3441
\var{flags} specifies the nature of the mapping.
3542
\code{MAP_PRIVATE} creates a private copy-on-write mapping, so
@@ -61,8 +68,10 @@ \section{\module{mmap} ---
6168
\begin{methoddesc}{flush}{\optional{\var{offset}, \var{size}}}
6269
Flushes changes made to the in-memory copy of a file back to disk.
6370
Without use of this call there is no guarantee that changes are
64-
written back before the object is destroyed. If \var{offset}
65-
and \var{size} are specified, only changes to the given range of bytes will be flushed to disk; otherwise, the whole extent of the mapping is flushed.
71+
written back before the object is destroyed. If \var{offset} and
72+
\var{size} are specified, only changes to the given range of bytes
73+
will be flushed to disk; otherwise, the whole extent of the mapping is
74+
flushed.
6675
\end{methoddesc}
6776

6877
\begin{methoddesc}{move}{\var{dest}, \var{src}, \var{count}}
@@ -71,14 +80,14 @@ \section{\module{mmap} ---
7180
\end{methoddesc}
7281

7382
\begin{methoddesc}{read}{\var{num}}
74-
Return a string containing up to \var{num} bytes taken from the
83+
Return a string containing up to \var{num} bytes starting from the
7584
current file position; the file position is updated to point after the
7685
bytes that were returned.
7786
\end{methoddesc}
7887

7988
\begin{methoddesc}{read_byte}{}
80-
Returns the character at the current file position, and advancing
81-
the file position by 1.
89+
Returns a string of length 1 containing the character at the current
90+
file position, and advances the file position by 1.
8291
\end{methoddesc}
8392

8493
\begin{methoddesc}{readline}{}
@@ -113,7 +122,7 @@ \section{\module{mmap} ---
113122
\end{methoddesc}
114123

115124
\begin{methoddesc}{write_byte}{\var{byte}}
116-
Write \var{byte} into memory at the current position of
125+
Write the single-character string \var{byte} into memory at the current position of
117126
the file pointer; the file position is advanced by 1.
118127
\end{methoddesc}
119128

0 commit comments

Comments
 (0)