Python 2.7b1 and argparse's version action

T

Tobias Herp

Hi, all,

I notice that Python 2.7 beta 1 now contains the argparse module, which
might be a good thing. The code has been cleaned up, too.

But there is still one issue with argparse:
Completely unnecessarily, the 'version' constructor argument is now
deprecated. This fact doesn't solve any problem I can think of; the
only effect is to make programming more cumbersome, and it is /one more/
difference to optparse.

The 'version' argument is a perfectly reasonable way to provide a script
with a simple version information feature. Of course, it should only
define the '--version' argument; it *must not* define '-v' for this
purpose, since this is commonly used for verbosity. I have lots of
scripts which use optparse, and every single one uses the version
argument. I consider this a matter of good style.

Of course, if a more fancy version information is needed, it is
perfectly possible to just omit the version argument during creation
and build a special 'version' action, e.g. reporting the versions of all
imported modules. No deprecation warnings are needed for this.

*Before Python 2.7 getting a production release*, IMNSHO the following
changes should be applied to argparse.py:

- removal of the deprecation warnings
- removal of the default usage of '-v'
with the version information facility

This is a very simple thing to do; I'd happily provide a patch.

Just for the records, this is what optparse does:
- it defines -h and --help for the help (unless suppressed)
- it defines --version for the version (if version argument given)
This is how it should be.
This is how the vast majority of *x tools looks like.
(well, some use '-h' for something like "host" or "human readable";
but just a few strange misfits use -v instead of -V for the version.)
No reason to change this behaviour.

What do you think?
 
C

Chris Rebert

Hi, all,

I notice that Python 2.7 beta 1 now contains the argparse module, which
might be a good thing.  The code has been cleaned up, too.

But there is still one issue with argparse:
Completely unnecessarily, the 'version' constructor argument is now
deprecated.  This fact doesn't solve any problem I can think of; the
only effect is to make programming more cumbersome, and it is /one more/
difference to optparse.
*Before Python 2.7 getting a production release*, IMNSHO the following
changes should be applied to argparse.py:

- removal of the deprecation warnings
- removal of the default usage of '-v'
 with the version information facility

This is a very simple thing to do; I'd happily provide a patch.

Just for the records, this is what optparse does:
- it defines -h and --help for the help (unless suppressed)
- it defines --version for the version (if version argument given)
This is how it should be.
This is how the vast majority of *x tools looks like.
 (well, some use '-h' for something like "host" or "human readable";
 but just a few strange misfits use -v instead of -V for the version..)
No reason to change this behaviour.

What do you think?

You'd probably ought to just complain upstream to the argparse project
itself. The change doesn't seem to have been made specifically for std
lib inclusion (though I didn't read the bug in depth).

This looks like the relevant issue:
http://code.google.com/p/argparse/issues/detail?id=43

Relevant revision:
http://code.google.com/p/argparse/source/detail?r=83

Cheers,
Chris
 
T

Tobias Herp

Am 18.04.2010 04:09, schrieb Chris Rebert:
You'd probably ought to just complain upstream to the argparse project
itself. The change doesn't seem to have been made specifically for std
lib inclusion (though I didn't read the bug in depth).

This looks like the relevant issue:
http://code.google.com/p/argparse/issues/detail?id=43

Yes, this is the issue I once submitted. I had a very hard time
discussing, since Steven insisted (and apparently still insists) in -v
as a reasonable default short option for the version feature.

Then I had some password database problems, and during the time I fell
silent, he decided to deprecate the version argument.

Since the code has been cleaned up and differs in many details from the
current argparse v1.1, I hoped for somebody with a Python hat on to say,
"This module is nice, but to make it in a production release of Python
these simple issues must be fixed."

To plagiarise Galahad (Monty Python and the Holy Grail):
"Is there someone else up there we could talk to?"
 
M

Martin v. Loewis

What do you think?

If you want something to happen, you need to bring this up on python-dev.

Regards,
Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,046
Latest member
Gavizuho

Latest Threads

Top