Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #18549
| Date | 2012-01-05 13:29 +0000 |
|---|---|
| From | Andrea Crotti <andrea.crotti.0@gmail.com> |
| Subject | Re: argparse and default values |
| References | <4F05A489.1010604@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.4450.1325770178.27778.python-list@python.org> (permalink) |
On 01/05/2012 01:24 PM, Andrea Crotti wrote:
> There's one thing I don't understand about argparse, why doesn't
> --help show what is the default value??
> I mean if I add an option that can be customized it would be good for
> the user
> to know what is the current value in my opinion.
>
> Is there a way to make it show it?
Looking at the code I found it already
parser = argparse.ArgumentParser(description=description,
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
the only thing is that it displays also "default: None" which isn't
probably very useful,
but it would easy to write my own formatter and pass it if I don't like
this..
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: argparse and default values Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-01-05 13:29 +0000
csiph-web