[Python-checkins] python/dist/src/Doc/lib liboptparse.tex,1.9,1.10 libpdb.tex,1.36,1.37 librfc822.tex,1.43,1.44
fdrake@users.sourceforge.net
fdrake@users.sourceforge.net
Wed, 16 Jul 2003 10:58:41 -0700
Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv17452/lib
Modified Files:
liboptparse.tex libpdb.tex librfc822.tex
Log Message:
Lots of markup cleanups to avoid warnings from the GNU info generation;
these make sense even without that processing chain.
Index: liboptparse.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/liboptparse.tex,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** liboptparse.tex 10 May 2003 03:35:37 -0000 1.9
--- liboptparse.tex 16 Jul 2003 17:58:38 -0000 1.10
***************
*** 83,94 ****
shell passes to \cfunction{execl()} or \cfunction{execv()}. In
Python, arguments are elements of
! \var{sys.argv[1:]}. (\var{sys.argv[0]} is the name of the program
being executed; in the context of parsing arguments, it's not very
important.) \UNIX{} shells also use the term ``word''.
It is occasionally desirable to use an argument list other than
! \var{sys.argv[1:]}, so you should read ``argument'' as ``an element of
! \var{sys.argv[1:]}, or of some other list provided as a substitute for
! \var{sys.argv[1:]}''.
\term{option}
--- 83,94 ----
shell passes to \cfunction{execl()} or \cfunction{execv()}. In
Python, arguments are elements of
! \code{sys.argv[1:]}. (\code{sys.argv[0]} is the name of the program
being executed; in the context of parsing arguments, it's not very
important.) \UNIX{} shells also use the term ``word''.
It is occasionally desirable to use an argument list other than
! \code{sys.argv[1:]}, so you should read ``argument'' as ``an element of
! \code{sys.argv[1:]}, or of some other list provided as a substitute for
! \code{sys.argv[1:]}''.
\term{option}
***************
*** 307,314 ****
(Note that if you don't pass an argument list to
! \function{parse_args()}, it automatically uses \var{sys.argv[1:]}.)
When \module{optparse} sees the \programopt{-f}, it consumes the next
! argument---\code{foo.txt}---and stores it in the \var{filename}
attribute of a special object. That object is the first return value
from \function{parse_args()}, so:
--- 307,314 ----
(Note that if you don't pass an argument list to
! \function{parse_args()}, it automatically uses \code{sys.argv[1:]}.)
When \module{optparse} sees the \programopt{-f}, it consumes the next
! argument---\code{foo.txt}---and stores it in the \member{filename}
attribute of a special object. That object is the first return value
from \function{parse_args()}, so:
***************
*** 355,361 ****
sensible default from the option strings: if the first long option
string is \longprogramopt{foo-bar}, then the default destination is
! \var{foo_bar}. If there are no long option strings,
\module{optparse} looks at the first short option: the default
! destination for \programopt{-f} is \var{f}.
Adding types is fairly easy; please refer to
--- 355,361 ----
sensible default from the option strings: if the first long option
string is \longprogramopt{foo-bar}, then the default destination is
! \member{foo_bar}. If there are no long option strings,
\module{optparse} looks at the first short option: the default
! destination for \programopt{-f} is \member{f}.
Adding types is fairly easy; please refer to
***************
*** 381,386 ****
When \module{optparse} sees \programopt{-v} on the command line, it sets
! \var{options.verbose} to \code{True}; when it sees \programopt{-q}, it
! sets \var{options.verbose} to \code{False}.
\subsubsection{Setting default values\label{optparse-setting-default-values}}
--- 381,386 ----
When \module{optparse} sees \programopt{-v} on the command line, it sets
! \code{options.verbose} to \code{True}; when it sees \programopt{-q}, it
! sets \code{options.verbose} to \code{False}.
\subsubsection{Setting default values\label{optparse-setting-default-values}}
***************
*** 395,399 ****
First, consider the verbose/quiet example. If we want
! \module{optparse} to set \var{verbose} to \code{True} unless
\programopt{-q} is seen, then we can do this:
--- 395,399 ----
First, consider the verbose/quiet example. If we want
! \module{optparse} to set \member{verbose} to \code{True} unless
\programopt{-q} is seen, then we can do this:
***************
*** 412,416 ****
Those are equivalent because you're supplying a default value for the
option's \emph{destination}, and these two options happen to have the same
! destination (the \var{verbose} variable).
Consider this:
--- 412,416 ----
Those are equivalent because you're supplying a default value for the
option's \emph{destination}, and these two options happen to have the same
! destination (the \member{verbose} variable).
Consider this:
***************
*** 421,425 ****
\end{verbatim}
! Again, the default value for \var{verbose} will be \code{True}: the last
default value supplied for any particular destination is the one that
counts.
--- 421,425 ----
\end{verbatim}
! Again, the default value for \member{verbose} will be \code{True}: the last
default value supplied for any particular destination is the one that
counts.
***************
*** 429,433 ****
The last feature that you will use in every script is
\module{optparse}'s ability to generate help messages. All you have
! to do is supply a \var{help} value when you add an option. Let's
create a new parser and populate it with user-friendly (documented)
options:
--- 429,433 ----
The last feature that you will use in every script is
\module{optparse}'s ability to generate help messages. All you have
! to do is supply a \var{help} argument when you add an option. Let's
create a new parser and populate it with user-friendly (documented)
options:
***************
*** 739,743 ****
one of the first things \module{optparse} does is create a
! \var{values} object:
\begin{verbatim}
--- 739,743 ----
one of the first things \module{optparse} does is create a
! \code{values} object:
\begin{verbatim}
***************
*** 787,791 ****
line; all will be converted according to \var{type} and stored to
\var{dest} as a tuple. See section~\ref{optparse-option-types},
! ``Option types'' below.
If \var{choices} (a sequence of strings) is supplied, the type
--- 787,791 ----
line; all will be converted according to \var{type} and stored to
\var{dest} as a tuple. See section~\ref{optparse-option-types},
! ``Option types,'' below.
If \var{choices} (a sequence of strings) is supplied, the type
***************
*** 796,802 ****
If \var{dest} is not supplied, \module{optparse} derives a
destination from the first long option strings (e.g.,
! \longprogramopt{foo-bar} becomes \var{foo_bar}). If there are no long
option strings, \module{optparse} derives a destination from the first
! short option string (e.g., \programopt{-f} becomes \var{f}).
Example:
--- 796,802 ----
If \var{dest} is not supplied, \module{optparse} derives a
destination from the first long option strings (e.g.,
! \longprogramopt{foo-bar} becomes \member{foo_bar}). If there are no long
option strings, \module{optparse} derives a destination from the first
! short option string (e.g., \programopt{-f} becomes \member{f}).
Example:
***************
*** 1218,1222 ****
is the option string seen on the command-line that's triggering the
callback. (If an abbreviated long option was used, \var{opt} will be
! the full, canonical option string---e.g. if the user puts
\longprogramopt{foo} on the command-line as an abbreviation for
\longprogramopt{foobar}, then \var{opt} will be
--- 1218,1222 ----
is the option string seen on the command-line that's triggering the
callback. (If an abbreviated long option was used, \var{opt} will be
! the full, canonical option string---for example, if the user puts
\longprogramopt{foo} on the command-line as an abbreviation for
\longprogramopt{foobar}, then \var{opt} will be
***************
*** 1677,1681 ****
command-line syntax implemented by \module{optparse}. In this case,
you'd leave the whole machinery of option actions and types alone, but
! rewrite the code that processes \var{sys.argv}. You'll need to
subclass \class{OptionParser} in any case; depending on how radical a
rewrite you want, you'll probably need to override one or all of
--- 1677,1681 ----
command-line syntax implemented by \module{optparse}. In this case,
you'd leave the whole machinery of option actions and types alone, but
! rewrite the code that processes \code{sys.argv}. You'll need to
subclass \class{OptionParser} in any case; depending on how radical a
rewrite you want, you'll probably need to override one or all of
Index: libpdb.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libpdb.tex,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** libpdb.tex 18 Dec 2002 02:07:14 -0000 1.36
--- libpdb.tex 16 Jul 2003 17:58:38 -0000 1.37
***************
*** 266,270 ****
of a \keyword{finally} clause.
! \item[l(ist) \optional{\var{first\optional{, last}}}]
List source code for the current file. Without arguments, list 11
--- 266,270 ----
of a \keyword{finally} clause.
! \item[l(ist) \optional{\var{first}\optional{, \var{last}}}]
List source code for the current file. Without arguments, list 11
Index: librfc822.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/librfc822.tex,v
retrieving revision 1.43
retrieving revision 1.44
diff -C2 -d -r1.43 -r1.44
*** librfc822.tex 9 Oct 2002 22:33:23 -0000 1.43
--- librfc822.tex 16 Jul 2003 17:58:38 -0000 1.44
***************
*** 256,263 ****
\code{\var{m}.getheader(name)} but raises \exception{KeyError} if
there is no matching header; and \code{len(\var{m})},
! \code{\var{m}.get(\var{name}\optional{\var{, default}})},
\code{\var{m}.has_key(\var{name})}, \code{\var{m}.keys()},
\code{\var{m}.values()} \code{\var{m}.items()}, and
! \code{\var{m}.setdefault(\var{name}\optional{\var{, default}})} act as
expected, with the one difference that \method{setdefault()} uses
an empty string as the default value. \class{Message} instances
--- 256,263 ----
\code{\var{m}.getheader(name)} but raises \exception{KeyError} if
there is no matching header; and \code{len(\var{m})},
! \code{\var{m}.get(\var{name}\optional{, \var{default}})},
\code{\var{m}.has_key(\var{name})}, \code{\var{m}.keys()},
\code{\var{m}.values()} \code{\var{m}.items()}, and
! \code{\var{m}.setdefault(\var{name}\optional{, \var{default}})} act as
expected, with the one difference that \method{setdefault()} uses
an empty string as the default value. \class{Message} instances