Is this really the correct approach for argparse? My gut instinct is that
argparse
should provide one additional method, something like load_from_dict() which
external
applications will provide data to.
Argparse should absolutely not be involved in calculating these kind of
env/config
hierarchies itself, in my opinion.
I would like to do something like this with sanescript [1], for which I
already use
argparse, but am having some problems, because even while overriding
error()/exit()
control flow is broken, and so I can't then update information from.
I am nto sure if that is the same bug, or a different one
[1] http://bitbucket.org/aafshar/sanescript-main/overview/
--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings
Comment #6 on issue 35 by steven.bethard: Support for env/config file
hierarchy
http://code.google.com/p/argparse/issues/detail?id=35
I'm closing this as WontFix because of the lack of consensus. Basically the
proposals were:
* Have add_argument accept some additional parameters to indicate
corresponding config file names and environment variables.
* Add a method like "load_from_dict" that would allow such loading to be
done explicitly.
The former will complicate the already complicated add_argument parameters,
while the latter probably isn't much better than calling set_defaults
before parsing.
Despite the fact that I'm closing this issue, in general I'd like to make
it easier to support something like this. If anyone here would like to make
another suggested API, please file a new bug at bugs.python.org (where
argparse development has moved).