Author paul.j3
Recipients amcnabb, bethard, docs@python, guilherme-pg, paul.j3, r.david.murray, v+python
Date 2013-05-10.22:39:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1368225541.72.0.704146742925.issue14191@psf.upfronthosting.co.za>
In-reply-to
Content
I should note one caveat:

As a consequence of setting nargs to 0 for the first 'parse_know_args' step, all positional entries in the namespace get an empty list value ([]).  This is produced by 'ArgumentParser._get_values'.  With the builtin action classes this does not cause any problems.

However a custom action class might have problems with this [] value.
For example in 'test_argparse.py', TestActionUserDefined the PositionalAction class does check the values and throws an error with this [] value.

The positional arguments are removed from the namespace before it is passed on to the 2nd 'parse_known_args', so these [] in the first don't affect the final namespace.

I don't think anything about this should be added to main documentation, since it could confuse most readers.  I might add a note of warning to the code itself.
History
Date User Action Args
2013-05-10 22:39:01paul.j3setrecipients: + paul.j3, amcnabb, bethard, v+python, r.david.murray, docs@python, guilherme-pg
2013-05-10 22:39:01paul.j3setmessageid: <1368225541.72.0.704146742925.issue14191@psf.upfronthosting.co.za>
2013-05-10 22:39:01paul.j3linkissue14191 messages
2013-05-10 22:39:01paul.j3create