Closed GoogleCodeExporter closed 9 years ago
I'm curious what your use case is that requires calling ``parse_args`` more than
once. Could you elaborate?
Original comment by steven.b...@gmail.com
on 28 Mar 2009 at 6:28
The use case is:
"I needed to parse the command line twice, because I wanted to combine options
from
the command line and from a configuration file: I parse the command line and
check if
there is a '--config=FILE' option. If there is, I parse the config file and call
set_defaults() for each item there. This way I get the same error checking etc.
for
free. After this I need of course to re-parse the command line so that its
options
override the ones from the config file."
The fix, I believe should be to rewrite _AppendAction and _AppendConstAction to
do
something like:
items = _ensure_value(namespace, self.dest, []) + [values]
setattr(namespace, self.dest, items)
instead of the current call to append.
Original comment by steven.b...@gmail.com
on 29 Apr 2009 at 6:15
All append actions copy their destination list as of r21.
Original comment by steven.b...@gmail.com
on 4 May 2009 at 5:22
Not sure why this was marked as fixed. argparse 1.2.1 still has this issue.
Original comment by si...@hova.net
on 7 Oct 2011 at 12:57
The issue that was fixed was that if a default is supplied, it is copied so
that multiple calls to parse_args work correctly.
I assume you're asking for the default for the "append" action to be an empty
list? If so, please open a new issue for that, at the argparse bug tracker,
which is the Python bug tracker: http://bugs.python.org/ Bugs reported to the
Google Code tracker are likely to be lost.
Original comment by steven.b...@gmail.com
on 15 Dec 2011 at 1:21
Original issue reported on code.google.com by
steven.b...@gmail.com
on 27 Mar 2009 at 4:59