[Python-checkins] r71540 - python/trunk/Lib/optparse.py

georg.brandl python-checkins at python.org
Sun Apr 12 22:30:53 CEST 2009


Author: georg.brandl
Date: Sun Apr 12 22:30:53 2009
New Revision: 71540

Log:
#5719: add short usage example to optparse docstring.

Modified:
   python/trunk/Lib/optparse.py

Modified: python/trunk/Lib/optparse.py
==============================================================================
--- python/trunk/Lib/optparse.py	(original)
+++ python/trunk/Lib/optparse.py	Sun Apr 12 22:30:53 2009
@@ -6,6 +6,19 @@
 
 For support, use the optik-users at lists.sourceforge.net mailing list
 (http://lists.sourceforge.net/lists/listinfo/optik-users).
+
+Simple usage example:
+
+   from optparse import OptionParser
+
+   parser = OptionParser()
+   parser.add_option("-f", "--file", dest="filename",
+                     help="write report to FILE", metavar="FILE")
+   parser.add_option("-q", "--quiet",
+                     action="store_false", dest="verbose", default=True,
+                     help="don't print status messages to stdout")
+
+   (options, args) = parser.parse_args()
 """
 
 __version__ = "1.5.3"


More information about the Python-checkins mailing list