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 skip.montanaro
Recipients skip.montanaro
Date 2008-06-11.22:50:16
SpamBayes Score 0.0061170426
Marked as misclassified No
Message-id <18512.1923.657436.704863@montanaro-dyndns-org.local>
In-reply-to
Content
This seems like a bug in optparse.OptionParser:

    def exit(self, status=0, msg=None):
        if msg:
            sys.stderr.write(msg)
        sys.exit(status)

    def error(self, msg):
        """error(msg : string)

        Print a usage message incorporating 'msg' to stderr and exit.
        If you override this in a subclass, it should not return -- it
        should either exit or raise an exception.
        """
        self.print_usage(sys.stderr)
        self.exit(2, "%s: error: %s\n" % (self.get_prog_name(), msg))

By default I think it should raise an exception when it encounters an error,
not exit.  Programmers shouldn't be forced to subclass code in the standard
library to get recommended practice.

If you feel this behavior can't be changed in 2.6 it should at least be
corrected in 3.0.

Skip
History
Date User Action Args
2008-06-11 22:50:19skip.montanarosetspambayes_score: 0.00611704 -> 0.0061170426
recipients: + skip.montanaro
2008-06-11 22:50:17skip.montanarolinkissue3084 messages
2008-06-11 22:50:17skip.montanarocreate