diff options
author | Fred Drake <fdrake@acm.org> | 1999-04-20 13:41:14 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 1999-04-20 13:41:14 (GMT) |
commit | ad56dafd62baf60d6be28481154d1a69bb966ca3 (patch) | |
tree | 7620c5ff4677f4f464ba2b8208c9bf9707c8c3fd /Doc/lib | |
parent | 068d5724d82e065fc636814e332078edd7cb30fe (diff) | |
download | cpython-ad56dafd62baf60d6be28481154d1a69bb966ca3.zip cpython-ad56dafd62baf60d6be28481154d1a69bb966ca3.tar.gz cpython-ad56dafd62baf60d6be28481154d1a69bb966ca3.tar.bz2 |
Added example use of pack_list() to help explain the pack_item
parameter. Lack of clarity reported by Matthew Gallagher
<hew@hons.cs.usyd.edu.au>.
Diffstat (limited to 'Doc/lib')
-rw-r--r-- | Doc/lib/libxdrlib.tex | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Doc/lib/libxdrlib.tex b/Doc/lib/libxdrlib.tex index 3565eb7..57329d7 100644 --- a/Doc/lib/libxdrlib.tex +++ b/Doc/lib/libxdrlib.tex @@ -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} |