[issue9351] argparse set_defaults on subcommands should override top level set_defaults

Petri Lehtinen report at bugs.python.org
Mon Oct 29 20:39:38 CET 2012


Petri Lehtinen added the comment:

+        for key in vars(subnamespace):
+            setattr(namespace, key, getattr(subnamespace, key))

There might be even more clever ways to achieve this, but what about at least saying "for key, value in vars(subnamespace).items()", and then using the value accordingly, to avoid the getattr() call?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9351>
_______________________________________


More information about the Python-bugs-list mailing list