Cheryl Sabella added the comment: I submitted a PR for this based on paul.j3's suggested change:
def _format_action_invocation(self, action): .... for option_string in action.option_strings: if len(args_string)>0: parts.append('%s %s' % (option_string, args_string)) else: parts.append('%s' % option_string) .... I created a test that would have duplicated the original issue and, with the change, no longer prints the extra blank. To Serhiy's point, I'm not sure if an empty metavar makes sense since it's intention is to give the parser a way to refer to the expected arguments within the help messages. However, with no metavar at all, the help output is: -f FOO, --foo FOO With metavar = '' (and this change), the output is: -f, --foo With metavar = '' (and without this change), the output is: -f , --foo ---------- nosy: +csabella _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29626> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com