[Python-checkins] r74877 - python/trunk/Doc/library/optparse.rst
georg.brandl
python-checkins at python.org
Thu Sep 17 18:26:06 CEST 2009
Author: georg.brandl
Date: Thu Sep 17 18:26:06 2009
New Revision: 74877
Log:
Remove duplicate doc of enable/disable_interspersed_args.
Modified:
python/trunk/Doc/library/optparse.rst
Modified: python/trunk/Doc/library/optparse.rst
==============================================================================
--- python/trunk/Doc/library/optparse.rst (original)
+++ python/trunk/Doc/library/optparse.rst Thu Sep 17 18:26:06 2009
@@ -1207,18 +1207,27 @@
OptionParser provides several methods to help you out:
``disable_interspersed_args()``
- Set parsing to stop on the first non-option. Use this if you have a
- command processor which runs another command which has options of
- its own and you want to make sure these options don't get
- confused. For example, each command might have a different
- set of options.
+ Set parsing to stop on the first non-option. For example, if ``"-a"`` and
+ ``"-b"`` are both simple options that take no arguments, :mod:`optparse`
+ normally accepts this syntax::
+
+ prog -a arg1 -b arg2
+
+ and treats it as equivalent to ::
+
+ prog -a -b arg1 arg2
+
+ To disable this feature, call ``disable_interspersed_args()``. This restores
+ traditional Unix syntax, where option parsing stops with the first non-option
+ argument.
+
+ Use this if you have a command processor which runs another command which has
+ options of its own and you want to make sure these options don't get confused.
+ For example, each command might have a different set of options.
``enable_interspersed_args()``
- Set parsing to not stop on the first non-option, allowing
- interspersing switches with command arguments. For example,
- ``"-s arg1 --long arg2"`` would return ``["arg1", "arg2"]``
- as the command arguments and ``-s, --long`` as options.
- This is the default behavior.
+ Set parsing to not stop on the first non-option, allowing interspersing
+ switches with command arguments. This is the default behavior.
``get_option(opt_str)``
Returns the Option instance with the option string ``opt_str``, or ``None`` if
@@ -1329,23 +1338,6 @@
constructor keyword argument. Passing ``None`` sets the default usage string;
use ``SUPPRESS_USAGE`` to suppress a usage message.
-* ``enable_interspersed_args()``, ``disable_interspersed_args()``
-
- Enable/disable positional arguments interspersed with options, similar to GNU
- getopt (enabled by default). For example, if ``"-a"`` and ``"-b"`` are both
- simple options that take no arguments, :mod:`optparse` normally accepts this
- syntax::
-
- prog -a arg1 -b arg2
-
- and treats it as equivalent to ::
-
- prog -a -b arg1 arg2
-
- To disable this feature, call ``disable_interspersed_args()``. This restores
- traditional Unix syntax, where option parsing stops with the first non-option
- argument.
-
* ``set_defaults(dest=value, ...)``
Set default values for several option destinations at once. Using
More information about the Python-checkins
mailing list