~ubuntu-branches/ubuntu/lucid/python2.6/lucid

« back to all changes in this revision

Viewing changes to Doc/library/getopt.rst

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2010-03-11 13:30:19 UTC
  • mto: (10.1.13 sid)
  • mto: This revision was merged to the branch mainline in revision 44.
  • Revision ID: james.westby@ubuntu.com-20100311133019-sblbooa3uqrkoe70
Tags: upstream-2.6.5~rc2
ImportĀ upstreamĀ versionĀ 2.6.5~rc2

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
 
31
31
   .. note::
32
32
 
33
 
      Unlike GNU :cfunc:`getopt`, after a non-option argument, all further arguments
34
 
      are considered also non-options. This is similar to the way non-GNU Unix systems
35
 
      work.
 
33
      Unlike GNU :cfunc:`getopt`, after a non-option argument, all further
 
34
      arguments are considered also non-options. This is similar to the way
 
35
      non-GNU Unix systems work.
36
36
 
37
37
   *long_options*, if specified, must be a list of strings with the names of the
38
 
   long options which should be supported.  The leading ``'-``\ ``-'`` characters
39
 
   should not be included in the option name.  Long options which require an
40
 
   argument should be followed by an equal sign (``'='``).  To accept only long
41
 
   options, *options* should be an empty string.  Long options on the command line
42
 
   can be recognized so long as they provide a prefix of the option name that
43
 
   matches exactly one of the accepted options.  For example, if *long_options* is
44
 
   ``['foo', 'frob']``, the option :option:`--fo` will match as :option:`--foo`,
45
 
   but :option:`--f` will not match uniquely, so :exc:`GetoptError` will be raised.
 
38
   long options which should be supported.  The leading ``'-``\ ``-'``
 
39
   characters should not be included in the option name.  Long options which
 
40
   require an argument should be followed by an equal sign (``'='``).  Optional
 
41
   arguments are not supported.  To accept only long options, *options* should
 
42
   be an empty string.  Long options on the command line can be recognized so
 
43
   long as they provide a prefix of the option name that matches exactly one of
 
44
   the accepted options.  For example, if *long_options* is ``['foo', 'frob']``,
 
45
   the option :option:`--fo` will match as :option:`--foo`, but :option:`--f`
 
46
   will not match uniquely, so :exc:`GetoptError` will be raised.
46
47
 
47
48
   The return value consists of two elements: the first is a list of ``(option,
48
49
   value)`` pairs; the second is the list of program arguments left after the