New submission from Micheal Taylor <bubthegr...@gmail.com>:
There was an issue to make argparse.Namespace iterable with a specific intent on being able to convert it to a dictionary (https://bugs.python.org/issue8982). Additionally there was another improvement request to make it accessible like a dictionary. (https://bugs.python.org/issue8979) While vars(args) and args.thing do accomplish the needs, I'm really lazy, and would like the object to be more accessible - for instance, if I will always need to access every attribute (because I make a small namespace that fits a simple script, making it iterable would be convenient. It's also more convenient to use the typical **thing syntax for passing it into functions if all the attributes are required for different things. This keeps code within the functions that would use it simpler, because we no longer need to reference args.thing, we can reference thing directly within the function it's been passed to. vars(args) does accomplish this, but it is arguably not as familiar for folks as the more "familiar" syntax of **args. ---------- components: Library (Lib) messages: 326605 nosy: bubthegreat priority: normal severity: normal status: open title: Make argparse.NameSpace iterable versions: Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34827> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com