This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author n8falke
Recipients n8falke
Date 2019-02-22.15:03:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1550847834.23.0.972303586211.issue36078@roundup.psfhosted.org>
In-reply-to
Content
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)
==============
History
Date User Action Args
2019-02-22 15:03:54n8falkesetrecipients: + n8falke
2019-02-22 15:03:54n8falkesetmessageid: <1550847834.23.0.972303586211.issue36078@roundup.psfhosted.org>
2019-02-22 15:03:54n8falkelinkissue36078 messages
2019-02-22 15:03:54n8falkecreate