[Tutor] Subclassing a module's class.
Conrad
linux-user at softhome.net
Thu Jul 22 20:11:09 CEST 2004
I'm trying to subclass a class (HelpFormatter) from a module (optparse),
so that all calls will use my Helpformatter instead of
optparse.HelpFormatter.Currently I'm trying it like this:
import optparse
class HelpFormatter(optparse.HelpFormatter):
def format_option(self, option):
print "Hello, World!"
parser = optparse.OptionParser()
print parser.print_help
print_help() in optparse calls the class HelpFormatter. Can anyone
explain to me why it doesnt use my HelpFormatter?
Thanks for the time,
Conrad
More information about the Tutor
mailing list