Message250350
`parser.set_defaults` lets you set a default for any `dest`. It does not have to be connected with an argument. See what the docs say about using it to set an action linked to a subparser.
`arg1 = parser.add_argument(...)` returns an `Action` object. The parser collects these objects in its lists, but you can also save a reference to it yourself.
I'd suggest doing this in an interactive shell, and see for yourself the attributes of this object. Simply doing a 'print' on the object shows a number of the attributes (but not all). It is possible to view, and in some cases, even modify these attributes directly.
`args.choices` gives you access to the `choices` attribute.
I don't think there's a need for getter/setter methods for Action attributes. The attributes are accessible by normal Python object approaches.
p.s. Another forum for asking argparse how-to questions is Stackoverflow. Just tag it 'argparse'. |
|
Date |
User |
Action |
Args |
2015-09-10 02:50:45 | paul.j3 | set | recipients:
+ paul.j3, r.david.murray, Sworddragon |
2015-09-10 02:50:45 | paul.j3 | set | messageid: <1441853445.33.0.557635078168.issue25035@psf.upfronthosting.co.za> |
2015-09-10 02:50:45 | paul.j3 | link | issue25035 messages |
2015-09-10 02:50:45 | paul.j3 | create | |
|