[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

[ANN] argparse 1.1 - Command-line parsing library

Steven Bethard

3/1/2010 8:31:00 AM

=======================
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:
http://code.google.com/p...

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:

http://argparse.googlecode.com/svn/tags/r1...

Enjoy!

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