]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Added example use of pack_list() to help explain the pack_item
authorFred Drake <fdrake@acm.org>
Tue, 20 Apr 1999 13:41:14 +0000 (13:41 +0000)
committerFred Drake <fdrake@acm.org>
Tue, 20 Apr 1999 13:41:14 +0000 (13:41 +0000)
parameter.  Lack of clarity reported by Matthew Gallagher
<hew@hons.cs.usyd.edu.au>.

Doc/lib/libxdrlib.tex

index 3565eb77de403dfffcc0550ded73e40dd09b093d..57329d7994c9e401b2ff2f226dcb911d91ed5fe1 100644 (file)
@@ -95,6 +95,15 @@ unsigned integer \code{1} is packed first, followed by the data value
 from the list.  \var{pack_item} is the function that is called to pack
 the individual item.  At the end of the list, an unsigned integer
 \code{0} is packed.
+
+For example, to pack a list of integers, the code might appear like
+this:
+
+\begin{verbatim}
+import xdrlib
+p = xdrlib.Packer()
+p.pack_list([1, 2, 3], p.pack_int)
+\end{verbatim}
 \end{methoddesc}
 
 \begin{methoddesc}[Packer]{pack_farray}{n, array, pack_item}