[Python-Dev] argparse ugliness (original) (raw)
Ben Finney ben+python at benfinney.id.au
Mon Mar 8 22:55:50 CET 2010
- Previous message: [Python-Dev] argparse ugliness
- Next message: [Python-Dev] argparse ugliness
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
David Stanek <dstanek at dstanek.com> writes:
On Mon, Mar 8, 2010 at 10:40 AM, Steven Bethard <steven.bethard at gmail.com> wrote: > parser.addargument ('--plot', action='storetrue') […]
+1.
Any reason not to do something like:
from argparse import actions ... parser.addargument('--plot', actions.storetrue) Basically a small namespace for the constants.
-1.
That ignores the value to the programmer in specifying keyword arguments (there are a lot of arguments to the function, making keyword arguments a better mean-what-you-say choice). To be equivalent, it would have to be:
from argparse import actions
# ...
parser.add_argument('--plot', action=actions.store_true)
I prefer the string values.
-- \ “Value your freedom or you will lose it, teaches history. | `\ “Don't bother us with politics,” respond those who don't want | o_) to learn.” —Richard Stallman, 2002 | Ben Finney
- Previous message: [Python-Dev] argparse ugliness
- Next message: [Python-Dev] argparse ugliness
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]