paul j3 added the comment: This patch corrects the handling of `seen_non_default_action` in another case - a positional with '?' and `type=int` (or other conversion).
if parser.add_argument('badger', type=int, nargs='?', default=2) # or '2' and the original test 'seen_non_default_actions' is: if argument_values is not action.default 'argument_values' will be an 'int' regardless of the default. But it will pass the 'is' test with the (small) int default but not the string default. With the patch proposed here, both defaults behave the same - 'badger' will not appear in 'seen_non_default_actions' if it did not occur in the argument_strings (i.e. match an empty string). I may add case like this to `test_argparse.py` for this patch. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18943> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com