[issue4256] optparse: provide a simple way to get a programmatically useful list of options

Steven Bethard report at bugs.python.org
Wed Apr 21 19:50:38 CEST 2010

Steven Bethard <steven.bethard at gmail.com> added the comment:

On Wed, Apr 21, 2010 at 12:36 AM, Andy Buckley <report at bugs.python.org> wrote:
> Or to add the option just before arg parsing, if it has not already been defined?

Something like this was suggested before and it doesn't really work
out well. It means the first time you call .parse_args(), your options
get modified. So if you do anything with the parser before
.parse_args() -- for example, calling .print_help() -- then you don't
get the right options.

On Wed, Apr 21, 2010 at 5:12 AM, R. David Murray <report at bugs.python.org> wrote:
> I prefer an approach that allows this option to be defined by default

I agree that it would be best if all command line utilities supported
this by default[1]. I'm just not sure how to do it in a backwards
compatible way. The fact that the most recent patch against argparse
has to modify so many test cases suggests that it's going to have
unexpected consequences for a bunch of users.

[1] Though I'd feel more confident in that belief if someone could
point me to what the output of other programs that do this looks like
so that I could see we were following a standard somewhere.

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


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list