Message127582
Currently, there is no (documented) way to easily extract arguments in an argparse Namespace as a dictionary. This way, it would me easy to interface a function taking a lot of kwargs like this:
>>> args = parser.parse_args()
>>> my_function(**dict(args))
There's "_get_kwargs()" but it's a private undocumented method. I guess that making it public would be problematic because of the namespace pollution that would occur. That's why I'm proposing to make it iterable.
If it isn't rejected, I'd gladly work on the required patch. |
|
| Date |
User |
Action |
Args |
| 2011-01-31 08:05:03 | vdupras | set | recipients:
+ vdupras |
| 2011-01-31 08:05:03 | vdupras | set | messageid: <1296461103.49.0.397676179483.issue11076@psf.upfronthosting.co.za> |
| 2011-01-31 08:05:02 | vdupras | link | issue11076 messages |
| 2011-01-31 08:05:02 | vdupras | create | |
|