[New-bugs-announce] [issue35495] argparse does not honor default argument for nargs=argparse.REMAINDER argument
Ryan Govostes
report at bugs.python.org
Fri Dec 14 10:59:40 EST 2018
New submission from Ryan Govostes <rgovostes at gmail.com>:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument('things', nargs=argparse.REMAINDER, default=['nothing'])
parser.parse_args([])
>>> Namespace(things=[])
Since there were no unparsed arguments remaining, the `default` setting for `things` should have been honored. However it silently ignores this setting.
If there's a reason why this wouldn't be desirable, it should raise an exception that the options aren't compatible.
----------
components: Library (Lib)
messages: 331837
nosy: rgov
priority: normal
severity: normal
status: open
title: argparse does not honor default argument for nargs=argparse.REMAINDER argument
type: behavior
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35495>
_______________________________________
More information about the New-bugs-announce
mailing list