Axel <p...@jejajo.de> added the comment:
Some more details: The problem is not the order of assignment in take_action: Defaults have been set by: def parse_known_args(self, args=None, namespace=None): ... # add any action defaults that aren't present for action in self._actions: if action.dest is not SUPPRESS: if not hasattr(namespace, action.dest): if action.default is not SUPPRESS: setattr(namespace, action.dest, action.default) Assignment without argument should not happen, like the example shows: ============== from argparse import ArgumentParser parser = ArgumentParser() parser.add_argument('i', action="count", default=42) args = parser.parse_args([]) print(repr(args)) ============== Namespace(i=43) ============== ---------- nosy: -paul.j3 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36078> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com