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 cheryl.sabella
Recipients cheryl.sabella, falu2010, paul.j3, r.david.murray, serhiy.storchaka
Date 2017-05-28.01:05:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1495933558.16.0.975763328463.issue29626@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2017-05-28 01:05:58cheryl.sabellasetrecipients: + cheryl.sabella, r.david.murray, paul.j3, serhiy.storchaka, falu2010
2017-05-28 01:05:58cheryl.sabellasetmessageid: <1495933558.16.0.975763328463.issue29626@psf.upfronthosting.co.za>
2017-05-28 01:05:58cheryl.sabellalinkissue29626 messages
2017-05-28 01:05:56cheryl.sabellacreate