[Python-Dev] Pronouncement on PEP 389: argparse?

Steven Bethard steven.bethard at gmail.com
Tue Dec 15 18:14:32 CET 2009

On Tue, Dec 15, 2009 at 4:33 AM, Neal Becker <ndbecker2 at gmail.com> wrote:
> Ian Bicking wrote:
>> If argparse doesn't do this, then I think at least it should give good
>> error messages for all cases where these optparse-isms remain.  For
>> instance, now if you include %prog in your usage you get: ValueError:
>> unsupported format character 'p' (0x70) at index 1 -- that's simply a
>> bad error message.  Giving a proper error message takes about as much
>> code as making %prog work.  I don't feel strongly that one is better
>> than the other, but at least one of those should be done.
> I agree (and I've used both for quite a long time).  argparse has an api
> that is almost compatible with optparse in many common cases, but just
> renamed some things.

I can definitely improve some of the error messages for people coming
from optparse. I've created an issue for this, with the ``type='int'``
and "%prog" problems in there:


If you have other things that you know you'd like better exceptions
for, please add to that issue and I'll take care of it.

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

More information about the Python-Dev mailing list