mirror of
https://github.com/python/cpython.git
synced 2025-07-08 03:45:36 +00:00
Gerrit Holl's patch to move attribution from the docstring to a
comment. <gerrit@nl.linux.org>
This commit is contained in:
parent
2341794667
commit
a395ced424
1 changed files with 4 additions and 4 deletions
|
@ -7,9 +7,6 @@ and `--'). Long options similar to those supported by GNU software
|
||||||
may be used as well via an optional third argument. This module
|
may be used as well via an optional third argument. This module
|
||||||
provides a single function and an exception:
|
provides a single function and an exception:
|
||||||
|
|
||||||
Gerrit Holl <gerrit@nl.linux.org> moved the string-based exceptions
|
|
||||||
to class-based exceptions.
|
|
||||||
|
|
||||||
getopt() -- Parse command line options
|
getopt() -- Parse command line options
|
||||||
GetoptError -- exception (class) raised with 'opt' attribute, which is the
|
GetoptError -- exception (class) raised with 'opt' attribute, which is the
|
||||||
option involved with the exception.
|
option involved with the exception.
|
||||||
|
@ -17,6 +14,9 @@ option involved with the exception.
|
||||||
|
|
||||||
# Long option support added by Lars Wirzenius <liw@iki.fi>.
|
# Long option support added by Lars Wirzenius <liw@iki.fi>.
|
||||||
|
|
||||||
|
# Gerrit Holl <gerrit@nl.linux.org> moved the string-based exceptions
|
||||||
|
# to class-based exceptions.
|
||||||
|
|
||||||
import string
|
import string
|
||||||
|
|
||||||
class GetoptError(Exception):
|
class GetoptError(Exception):
|
||||||
|
@ -81,7 +81,7 @@ def getopt(args, shortopts, longopts = []):
|
||||||
|
|
||||||
def do_longs(opts, opt, longopts, args):
|
def do_longs(opts, opt, longopts, args):
|
||||||
try:
|
try:
|
||||||
i = string.index(opt, '=')
|
i = opt.index('=')
|
||||||
opt, optarg = opt[:i], opt[i+1:]
|
opt, optarg = opt[:i], opt[i+1:]
|
||||||
except ValueError:
|
except ValueError:
|
||||||
optarg = None
|
optarg = None
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue