This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.j3
Recipients Sworddragon, paul.j3, r.david.murray
Date 2015-09-10.02:50:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1441853445.33.0.557635078168.issue25035@psf.upfronthosting.co.za>
In-reply-to
Content
`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'.
History
Date User Action Args
2015-09-10 02:50:45paul.j3setrecipients: + paul.j3, r.david.murray, Sworddragon
2015-09-10 02:50:45paul.j3setmessageid: <1441853445.33.0.557635078168.issue25035@psf.upfronthosting.co.za>
2015-09-10 02:50:45paul.j3linkissue25035 messages
2015-09-10 02:50:45paul.j3create