Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #18549 > unrolled thread

Re: argparse and default values

Started byAndrea Crotti <andrea.crotti.0@gmail.com>
First post2012-01-05 13:29 +0000
Last post2012-01-05 13:29 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: argparse and default values Andrea Crotti <andrea.crotti.0@gmail.com> - 2012-01-05 13:29 +0000

#18549 — Re: argparse and default values

FromAndrea Crotti <andrea.crotti.0@gmail.com>
Date2012-01-05 13:29 +0000
SubjectRe: argparse and default values
Message-ID<mailman.4450.1325770178.27778.python-list@python.org>
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..

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web