]> granicus.if.org Git - python/commitdiff
Re-word the intro slightly to avoid reader misunderstanding: strings are not
authorFred Drake <fdrake@acm.org>
Mon, 3 Dec 2001 18:27:22 +0000 (18:27 +0000)
committerFred Drake <fdrake@acm.org>
Mon, 3 Dec 2001 18:27:22 +0000 (18:27 +0000)
mutable!  We do not want to shock anyone.
This closes SF bug #483805.

Re-factor so that the description of the "access" keyword parameter is not
repeated in both the descriptions of mmap().  Also, only make sure the first
description of mmap() appears in the index.  The the index link is followed,
the first is now used to locate the page on the screen; chances are really good
both will be visible.  This avoids the problem that the index entry for the
second is selected and the first version is not visible, making the reader
consider that mmap() is not available on Windows.

Doc/lib/libmmap.tex

index 466dfcc84ee150027290a2355ee56a16c5a7ae9a..426f6581cc691ef2943fd99e1c2b6c16d544d5d6 100644 (file)
@@ -4,8 +4,9 @@ Memory-mapped file support}
 \declaremodule{builtin}{mmap}
 \modulesynopsis{Interface to memory-mapped files for \UNIX\ and Windows.}
 
-Memory-mapped file objects behave like both mutable strings and like
-file objects.  You can use mmap objects in most places where strings
+Memory-mapped file objects behave like both strings and like
+file objects.  Unlike normal string objects, however, these are
+mutable.  You can use mmap objects in most places where strings
 are expected; for example, you can use the \module{re} module to
 search through a memory-mapped file.  Since they're mutable, you can
 change a single character by doing \code{obj[\var{index}] = 'a'}, or
@@ -23,6 +24,21 @@ If you wish to map an existing Python file object, use its
 \function{os.open()} function, which returns a file descriptor
 directly (the file still needs to be closed when done).
 
+For both the \UNIX{} and Windows versions of the function,
+\var{access} may be specified as an optional keyword parameter.
+\var{access} accepts one of three values: \constant{ACCESS_READ},
+\constant{ACCESS_WRITE}, or \constant{ACCESS_COPY} to specify
+readonly, write-through or copy-on-write memory respectively.
+\var{access} can be used on both \UNIX{} and Windows.  If
+\var{access} is not specified, Windows mmap returns a write-through
+mapping.  The initial memory values for all three access types are
+taken from the specified file.  Assignment to an
+\constant{ACCESS_READ} memory map raises a \exception{TypeError}
+exception.  Assignment to an \constant{ACCESS_WRITE} memory map
+affects both memory and the underlying file.  Assigment to an
+\constant{ACCESS_COPY} memory map affects memory but does not update
+the underlying file.
+
 \begin{funcdesc}{mmap}{fileno, length\optional{, tagname\optional{, access}}}
   \strong{(Windows version)} Maps \var{length} bytes from the file
   specified by the file handle \var{fileno}, and returns a mmap
@@ -38,23 +54,10 @@ directly (the file still needs to be closed when done).
   mapping is created without a name.  Avoiding the use of the tag
   parameter will assist in keeping your code portable between \UNIX{}
   and Windows.
-  
-  \var{access} may be specified as an optional keyword parameter.
-  \var{access} accepts one of three values: \constant{ACCESS_READ},
-  \constant{ACCESS_WRITE}, or \constant{ACCESS_COPY} to specify
-  readonly, write-through or copy-on-write memory respectively.
-  \var{access} can be used on both \UNIX{} and Windows.  If
-  \var{access} is not specified, Windows mmap returns a write-through
-  mapping.  The initial memory values for all three access types are
-  taken from the specified file.  Assignment to an
-  \constant{ACCESS_READ} memory map raises a \exception{TypeError}
-  exception.  Assignment to an \constant{ACCESS_WRITE} memory map
-  affects both memory and the underlying file.  Assigment to an
-  \constant{ACCESS_COPY} memory map affects memory but does not update
-  the underlying file.
 \end{funcdesc}
 
-\begin{funcdesc}{mmap}{fileno, length\optional{, flags\optional{, prot\optional{, access}}}}
+\begin{funcdescni}{mmap}{fileno, length\optional{, flags\optional{,
+                         prot\optional{, access}}}}
   \strong{(\UNIX{} version)} Maps \var{length} bytes from the file
   specified by the file descriptor \var{fileno}, and returns a mmap
   object.
@@ -72,19 +75,10 @@ directly (the file still needs to be closed when done).
   written.  \var{prot} defaults to \constant{PROT_READ | PROT_WRITE}.
   
   \var{access} may be specified in lieu of \var{flags} and \var{prot}
-  as an optional keyword parameter.  \var{access} accepts one of three
-  values: \constant{ACCESS_READ}, \constant{ACCESS_WRITE}, or
-  \constant{ACCESS_COPY} to specify readonly, write-through, or
-  copy-on-write memory respectively.  \var{access} can be used on both
-  \UNIX{} and Windows.  It is an error to specify both \var{flags},
-  \var{prot} and \var{access}.  The initial memory values for all
-  three access types are taken from the specified file.  Assignment to
-  an \constant{ACCESS_READ} memory map raises a \exception{TypeError}
-  exception.  Assignment to an \constant{ACCESS_WRITE} memory map
-  affects both memory and the underlying file.  Assigment to an
-  \constant{ACCESS_COPY} memory map affects memory but does not update
-  the underlying file.
-\end{funcdesc}
+  as an optional keyword parameter.  It is an error to specify both
+  \var{flags}, \var{prot} and \var{access}.  See the description of
+  \var{access} above for information on how to use this parameter.
+\end{funcdescni}
 
 
 Memory-mapped file objects support the following methods: