Message188887
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. |
|
Date |
User |
Action |
Args |
2013-05-10 22:39:01 | paul.j3 | set | recipients:
+ paul.j3, amcnabb, bethard, v+python, r.david.murray, docs@python, guilherme-pg |
2013-05-10 22:39:01 | paul.j3 | set | messageid: <1368225541.72.0.704146742925.issue14191@psf.upfronthosting.co.za> |
2013-05-10 22:39:01 | paul.j3 | link | issue14191 messages |
2013-05-10 22:39:01 | paul.j3 | create | |
|