Commits

Anonymous committed 0cb3255

[svn r74868] String values should be shown with quotes, to avoid confusion with constants.

  • Participants
  • Parent commits 95d0684

Comments (0)

Files changed (1)

File Doc/library/optparse.rst

 this option on the command-line.  The standard option actions hard-coded into
 :mod:`optparse` are:
 
-``store``
+``'store'``
    store this option's argument (default)
 
-``store_const``
+``'store_const'``
    store a constant value
 
-``store_true``
+``'store_true'``
    store a true value
 
-``store_false``
+``'store_false'``
    store a false value
 
-``append``
+``'append'``
    append this option's argument to a list
 
-``append_const``
+``'append_const'``
    append a constant value to a list
 
-``count``
+``'count'``
    increment a counter by one
 
-``callback``
+``'callback'``
    call a specified function
 
-:attr:`help`
+``'help'``
    print a usage message including all options and the documentation for them
 
 (If you don't supply an action, the default is ``store``.  For this action, you
 guide :mod:`optparse`'s behaviour; a few have required attributes, which you
 must specify for any option using that action.
 
-* ``store`` [relevant: :attr:`!type`, :attr:`dest`, ``nargs``, ``choices``]
+* ``'store'`` [relevant: :attr:`!type`, :attr:`dest`, ``nargs``, ``choices``]
 
   The option must be followed by an argument, which is converted to a value
   according to :attr:`!type` and stored in :attr:`dest`.  If ``nargs`` > 1,
   "Option types" section below.
 
   If ``choices`` is supplied (a list or tuple of strings), the type defaults to
-  ``choice``.
+  ``'choice'``.
 
   If :attr:`!type` is not supplied, it defaults to ``string``.
 
      options.point = (1.0, -3.5, 4.0)
      options.f = "bar.txt"
 
-* ``store_const`` [required: ``const``; relevant: :attr:`dest`]
+* ``'store_const'`` [required: ``const``; relevant: :attr:`dest`]
 
   The value ``const`` is stored in :attr:`dest`.
 
 
      options.verbose = 2
 
-* ``store_true`` [relevant: :attr:`dest`]
+* ``'store_true'`` [relevant: :attr:`dest`]
 
   A special case of ``store_const`` that stores a true value to :attr:`dest`.
 
-* ``store_false`` [relevant: :attr:`dest`]
+* ``'store_false'`` [relevant: :attr:`dest`]
 
   Like ``store_true``, but stores a false value.
 
      parser.add_option("--clobber", action="store_true", dest="clobber")
      parser.add_option("--no-clobber", action="store_false", dest="clobber")
 
-* ``append`` [relevant: :attr:`!type`, :attr:`dest`, ``nargs``, ``choices``]
+* ``'append'`` [relevant: :attr:`!type`, :attr:`dest`, ``nargs``, ``choices``]
 
   The option must be followed by an argument, which is appended to the list in
   :attr:`dest`.  If no default value for :attr:`dest` is supplied, an empty list
 
      options.tracks.append(int("4"))
 
-* ``append_const`` [required: ``const``; relevant: :attr:`dest`]
+* ``'append_const'`` [required: ``const``; relevant: :attr:`dest`]
 
   Like ``store_const``, but the value ``const`` is appended to :attr:`dest`; as
   with ``append``, :attr:`dest` defaults to ``None``, and an empty list is
   automatically created the first time the option is encountered.
 
-* ``count`` [relevant: :attr:`dest`]
+* ``'count'`` [relevant: :attr:`dest`]
 
   Increment the integer stored at :attr:`dest`.  If no default value is supplied,
   :attr:`dest` is set to zero before being incremented the first time.
 
      options.verbosity += 1
 
-* ``callback`` [required: ``callback``; relevant: :attr:`!type`, ``nargs``,
-  ``callback_args``, ``callback_kwargs``]
+* ``'callback'`` [required: ``callback``; relevant: :attr:`!type`, ``nargs``,
+  ``'callback_args'``, ``callback_kwargs``]
 
   Call the function specified by ``callback``, which is called as  ::
 
 
   See section :ref:`optparse-option-callbacks` for more detail.
 
-* :attr:`help`
+* ``'help'``
 
   Prints a complete help message for all the options in the current option parser.
   The help message is constructed from the ``usage`` string passed to
   After printing the help message, :mod:`optparse` terminates your process with
   ``sys.exit(0)``.
 
-* ``version``
+* ``'version'``
 
   Prints the version number supplied to the OptionParser to stdout and exits.  The
   version number is actually formatted and printed by the ``print_version()``
 
 The available conflict handlers are:
 
-   ``error`` (default)
+   ``'error'`` (default)
       assume option conflicts are a programming error and raise :exc:`OptionConflictError`
 
-   ``resolve``
+   ``'resolve'``
       resolve option conflicts intelligently (see below)