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 paul.j3
Recipients paul.j3, rhettinger, will
Date 2021-01-22.19:08:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1611342515.11.0.199917775517.issue42980@roundup.psfhosted.org>
In-reply-to
Content
I was thinking of a refactoring that included the ', '.join(...) loop, but on further thought your refactoring might be enough for the case I raised.

For example:

def _format_option_with_args(self, option_string, args_string):
        if option_string.startswith('--'):
            return '%s %s' % (option_string, args_string)
        return '%s' % option_string

would produce a

     -f, --foo FOO    something

and 

def _format_option_with_args(self, option_string, args_string):
        return option_string
       
would produce

     -f, --foo       something

I wonder if this refactoring merits some mention in the documentation.  Or maybe the GnuStyleLongOptionsHelpFormatter subclass is enough of an example.  The details of how other formatter subclasses work aren't documented, but they are available to developers who can read the code.
History
Date User Action Args
2021-01-22 19:08:35paul.j3setrecipients: + paul.j3, rhettinger, will
2021-01-22 19:08:35paul.j3setmessageid: <1611342515.11.0.199917775517.issue42980@roundup.psfhosted.org>
2021-01-22 19:08:35paul.j3linkissue42980 messages
2021-01-22 19:08:35paul.j3create