[Python-checkins] python/dist/src/Doc/tut tut.tex,1.162,1.163

fdrake@users.sourceforge.net fdrake@users.sourceforge.net
Mon, 10 Jun 2002 19:56:20 -0700


Update of /cvsroot/python/python/dist/src/Doc/tut
In directory usw-pr-cvs1:/tmp/cvs-serv26266/tut

Modified Files:
	tut.tex 
Log Message:
Completely revise markup for the list of list methods; the new markup matches
the semantics and presentation used in the library reference.
Added an explanation of the use of [...] to denote optional arguments, since
this is the only use of this in a signature line.
Closes SF bug #567127.


Index: tut.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/tut/tut.tex,v
retrieving revision 1.162
retrieving revision 1.163
diff -C2 -d -r1.162 -r1.163
*** tut.tex	29 May 2002 15:54:55 -0000	1.162
--- tut.tex	11 Jun 2002 02:56:17 -0000	1.163
***************
*** 1619,1661 ****
  of list objects:
  
! \begin{description}
! 
! \item[\code{append(x)}]
  Add an item to the end of the list;
! equivalent to \code{a[len(a):] = [x]}.
  
! \item[\code{extend(L)}]
  Extend the list by appending all the items in the given list;
! equivalent to \code{a[len(a):] = L}.
  
! \item[\code{insert(i, x)}]
! Insert an item at a given position.  The first argument is the index of
! the element before which to insert, so \code{a.insert(0, x)} inserts at
! the front of the list, and \code{a.insert(len(a), x)} is equivalent to
! \code{a.append(x)}.
  
! \item[\code{remove(x)}]
! Remove the first item from the list whose value is \code{x}.
  It is an error if there is no such item.
  
! \item[\code{pop(\optional{i})}]
  Remove the item at the given position in the list, and return it.  If
  no index is specified, \code{a.pop()} returns the last item in the
! list.  The item is also removed from the list.
  
! \item[\code{index(x)}]
! Return the index in the list of the first item whose value is \code{x}.
  It is an error if there is no such item.
  
! \item[\code{count(x)}]
! Return the number of times \code{x} appears in the list.
  
! \item[\code{sort()}]
  Sort the items of the list, in place.
  
! \item[\code{reverse()}]
  Reverse the elements of the list, in place.
! 
! \end{description}
  
  An example that uses most of the list methods:
--- 1619,1670 ----
  of list objects:
  
! \begin{methoddesc}[list]{append}{x}
  Add an item to the end of the list;
! equivalent to \code{a[len(a):] = [\var{x}]}.
! \end{methoddesc}
  
! \begin{methoddesc}[list]{extend}{L}
  Extend the list by appending all the items in the given list;
! equivalent to \code{a[len(a):] = \var{L}}.
! \end{methoddesc}
  
! \begin{methoddesc}[list]{insert}{i, x}
! Insert an item at a given position.  The first argument is the index
! of the element before which to insert, so \code{a.insert(0, \var{x})}
! inserts at the front of the list, and \code{a.insert(len(a), \var{x})}
! is equivalent to \code{a.append(\var{x})}.
! \end{methoddesc}
  
! \begin{methoddesc}[list]{remove}{x}
! Remove the first item from the list whose value is \var{x}.
  It is an error if there is no such item.
+ \end{methoddesc}
  
! \begin{methoddesc}[list]{pop}{\optional{i}}
  Remove the item at the given position in the list, and return it.  If
  no index is specified, \code{a.pop()} returns the last item in the
! list.  The item is also removed from the list.  (The square brackets
! around the \var{i} in the method signature denote that the parameter
! is optional, not that you should type square brackets at that
! position.  You will see this notation frequently in the
! \citetitle[../lib/lib.html]{Python Library Reference}.)
! \end{methoddesc}
  
! \begin{methoddesc}[list]{index}{x}
! Return the index in the list of the first item whose value is \var{x}.
  It is an error if there is no such item.
+ \end{methoddesc}
  
! \begin{methoddesc}[list]{count}{x}
! Return the number of times \var{x} appears in the list.
! \end{methoddesc}
  
! \begin{methoddesc}[list]{sort}{}
  Sort the items of the list, in place.
+ \end{methoddesc}
  
! \begin{methoddesc}[list]{reverse}{}
  Reverse the elements of the list, in place.
! \end{methoddesc}
  
  An example that uses most of the list methods: