[issue6253] optparse.OptionParser.get_usage uses wrong formatter

Sandro Tosi report at bugs.python.org
Thu Sep 30 17:57:04 CEST 2010

Sandro Tosi <sandro.tosi at gmail.com> added the comment:

Hello Jan,
I noticed this bug and I wondered: what's your opinion now?

Optparse is deprecated and it will be replaced by argparse, so I'm not sure it's "interesting" to introduce a new feature (the format_usage() method) but it might still be interesting to fix the previous behaviour.

So, are you still more inclined to add the new method or just correcting the harcoded formatter in get_usage() may be just fine?

If it's ok going on with the get_usage() fix, it's it just enough to:

    def get_usage(self, formatter=self.formatter):

and then just use 'formatter' (instead of checking if it's None, and then defaulting to self.formatter)? I didn't try this solution, so it might also be you've already tested and it's not working, just brain dumping :)


nosy: +sandro.tosi

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list