[issue25035] Getter/setter for argparse keys

2016-12-11 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> docs@python components: +Documentation -Library (Lib) nosy: +bethard, docs@python versions: +Python 3.7 -Python 3.4 ___ Python tracker

[issue25035] Getter/setter for argparse keys

2016-12-10 Thread paul j3
paul j3 added the comment: Yes, the information that `add_argument` returns a Action object is missing from the documentation. It might be useful addition. The documentation has many faults. It isn't basic enough to be a tutorial, but many first time users use it as such, and get confused

[issue25035] Getter/setter for argparse keys

2015-09-10 Thread Sworddragon
Sworddragon added the comment: In this case probably all is fine then. But there is a minor thing I noticed from one of your previous posts: You said parser.add_argument returns an Action object but I noticed that this is not mentioned on "16.4.3. The add_argument() method". Is it maybe

[issue25035] Getter/setter for argparse keys

2015-09-09 Thread R. David Murray
R. David Murray added the comment: Can you provide some specific use cases, please? -- nosy: +r.david.murray ___ Python tracker ___

[issue25035] Getter/setter for argparse keys

2015-09-09 Thread paul j3
paul j3 added the comment: `get_default` and `set_defaults` are parser methods, and do more than set or get a particular Action attribute. 'Set' for example changes both the 'parser._defaults' attribute, and a 'action.default' attribute. Defaults are complex and can be defined in at least 3

[issue25035] Getter/setter for argparse keys

2015-09-09 Thread Sworddragon
Sworddragon added the comment: I'm actually not fully sure why you are telling me this all, especially in this specific way. But I would also go the other way, by removing ArgumentParser.get_default and ArgumentParser.set_defaults if we think the current ways of getting/setting are enough.

[issue25035] Getter/setter for argparse keys

2015-09-09 Thread paul j3
paul j3 added the comment: `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

[issue25035] Getter/setter for argparse keys

2015-09-09 Thread Sworddragon
Sworddragon added the comment: I was myself in the case where I needed the values of the choices key of 2 specific arguments. Currently I'm solving this by storing them in variables but probably it could be cleaner by using a getter. -- ___ Python

[issue25035] Getter/setter for argparse keys

2015-09-08 Thread Sworddragon
New submission from Sworddragon: On making a look at the argparse documentation to figure out if I can get the value of the choices key of a specific argument after argument parsing or if I have to implement it myself I noticed that there is a getter/setter for the default key