[Tutor] Subclassing a module's class. (original) (raw)
Conrad linux-user at softhome.net
Thu Jul 22 20:11:09 CEST 2004
- Previous message: [Tutor] Is there a better way to do this?
- Next message: [Tutor] Subclassing a module's class.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Previous message: [Tutor] Is there a better way to do this?
- Next message: [Tutor] Subclassing a module's class.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]