yiwangai1983 / argparse

Automatically exported from code.google.com/p/argparse
Other
0 stars 0 forks source link

Bikeshedding: a specific method for store_true and store_false arguments #62

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
In the python-dev thread "argparse ugliness", it was suggested that there be 
a new ArgumentParser method for succinctly making store_true and 
store_false arguments. I propose calling it add_flag():

  add_flag('--flag') <-> add_argument('--flag', action='store_true')
  add_flag('--flag', default=True) <-> add_argument('--flag', 
action='store_false')

It's probably unnecessary, but I'd thought I'd toss it out there.

Original issue reported on code.google.com by robert.kern@gmail.com on 8 Mar 2010 at 6:59

GoogleCodeExporter commented 8 years ago
The original suggestion from Mark Russell was to spell it add_bool_argument().

Original comment by robert.kern@gmail.com on 8 Mar 2010 at 9:34

GoogleCodeExporter commented 8 years ago
Closing as WontFix here, mainly because while it shortens code, it adds to the 
API and what you have to remember for argparse. I'm not totally opposed to it 
though,  and if anyone feels strongly about it, please open a new issue at 
bugs.python.org (argparse's new home) and we can continue to discuss it.

Original comment by steven.b...@gmail.com on 23 Jul 2010 at 1:02