Announcing argparse 1.1
The argparse module provides an easy, declarative interface for
creating command line tools, which knows how to:
* parse the arguments and flags from sys.argv
* convert arg strings into objects for your program
* format and print informative help messages
* and much more...

The argparse module improves on the standard library optparse module
in a number of ways including:
* handling positional arguments
* supporting sub-commands
* allowing alternative option prefixes like + and /
* handling zero-or-more and one-or-more style arguments
* producing more informative usage messages
* providing a much simpler interface for custom types and actions

Download argparse
The argparse homepage has links for source, MSI and single file
distributions of argparse:

About this release
This is the final release of argparse before its move to the Python
2.7 and 3.2 standard libraries. Major enhancements in this release:

* ArgumentParser(..., version=XXX) is deprecated. Instead, you should
use add_argument(..., action='version') which is more flexible and
does not force you to accept -v/--version as your version flags.

* Usage and help (but not version) messages are now written to stdout
instead of stderr, consistent with most existing programs.

* User defined types passed as a type= argument can now raise an
ArgumentTypeError to provide a custom error message.

* Namespace objects now support containment, e.g. "'foo' in args".

Various bugs were also squashed, e.g. "from argparse import *" now
works. See the news file for detailed information:



Where did you get that preposterous hypothesis?
Did Steve tell you that?
--- The Hiphopopotamus

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppython-list @
postedMar 1, '10 at 8:31a
activeMar 1, '10 at 8:31a

1 user in discussion

Steven Bethard: 1 post



site design / logo © 2022 Grokbase