This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: getopt Documentation improvement
Type: Stage:
Components: Documentation Versions:
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: georg.brandl, guettli
Priority: normal Keywords:

Created on 2006-11-23 09:39 by guettli, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg30661 - (view) Author: Thomas Guettler (guettli) * Date: 2006-11-23 09:39
Hi,

I think the documentation of getopt could be
improved 

The example at the buttom:
http://docs.python.org/lib/module-getopt.html

1. Print str(exc)
except getopt.GetoptError, exc:
print str(exc)
usage()

2. In the loop: use elif and else

for o, a in opts:
    if o == "-v":
        verbose = True
    elif o in ("-h", "--help"):
        usage()
        sys.exit()
    else:
        raise AssertionError(
    "Unparsed Paremter: %s %s" %(o, a))

3. I would support --verbose, too

msg30662 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-11-23 09:55
Thanks, committed something along your lines in rev. 52833, 52834 (2.5).
History
Date User Action Args
2022-04-11 14:56:21adminsetgithub: 44268
2006-11-23 09:39:56guettlicreate