New submission from mcer45: The parameter argument_default=argparse.SUPPRESS seems to have no effect. Example:
===================================================================== help_dirs='ahoy parser = argparse.ArgumentParser( formatter_class=argparse.RawDescriptionHelpFormatter, description='Makes the calendar for the "year"', epilog=textwrap.dedent(help_dirs)) parser.add_argument("user", help='the user directory with the required structure in ./') parser.add_argument("year", type=int, help='the year for this calendar and also the directory for the output') parser.add_argument("-acc","--acc", default='no',nargs='?',choices=['yes','no'],const='yes', help='accomodate ratio according to the cover photo, default=no') parser.add_argument("--color",default='gold', choices=['gold'], help='default color: gold') args = parser.parse_args(['mc', '2015']) print(args) del parser del args parser = argparse.ArgumentParser(argument_default=argparse.SUPPRESS, formatter_class=argparse.RawDescriptionHelpFormatter, description='Makes the calendar for the "year"', epilog=textwrap.dedent(help_dirs)) parser.add_argument("user", help='the user directory with the required structure in ./') parser.add_argument("year", type=int, help='the year for this calendar and also the directory for the output') parser.add_argument("-acc","--acc", default='no',nargs='?',choices=['yes','no'],const='yes', help='accomodate ratio according to the cover photo, default=no') parser.add_argument("--color",default='gold', choices=['gold'], help='default color: gold') args = parser.parse_args(['mc', '2015']) =================================== The results in both cases are the same: Namespace(acc='no', color='gold', user='mc', year=2015) I hoped the defaults will be suppressed. ---------- components: Library (Lib) messages: 254478 nosy: bethard, mcer45 priority: normal severity: normal status: open title: argparse, argument_default=argparse.SUPPRESS seems to have no effect type: behavior versions: Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25600> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com