[Python-checkins] python/dist/src/Doc/lib libgetopt.tex,1.20,1.21

rhettinger@users.sourceforge.net rhettinger@users.sourceforge.net
Mon, 28 Apr 2003 21:35:39 -0700


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv26958

Modified Files:
	libgetopt.tex 
Log Message:
SF bug #729096:  getopt online documentation example improvement

A newbie found it difficult to translate the exampe into a
case that used only short options or long options but not both.
He tried to shorten the tuple search but forgot the trailing comma,
The appropriate pattern is an equality check.  

Revised the example to point him in the right direction.

Backport candidate.


Index: libgetopt.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libgetopt.tex,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** libgetopt.tex	6 Jun 2002 10:58:35 -0000	1.20
--- libgetopt.tex	29 Apr 2003 04:35:36 -0000	1.21
***************
*** 124,128 ****
  def main():
      try:
!         opts, args = getopt.getopt(sys.argv[1:], "ho:", ["help", "output="])
      except getopt.GetoptError:
          # print help information and exit:
--- 124,128 ----
  def main():
      try:
!         opts, args = getopt.getopt(sys.argv[1:], "ho:v", ["help", "output="])
      except getopt.GetoptError:
          # print help information and exit:
***************
*** 130,134 ****
--- 130,137 ----
          sys.exit(2)
      output = None
+     verbose = False
      for o, a in opts:
+         if o == "-v":
+             verbose = True
          if o in ("-h", "--help"):
              usage()