How to call functions with list and keyword arguments?

John Z. Smith jzsmith at optonline.net
Wed Nov 26 10:47:03 EST 2003


Hi,
   I want to subclass a class (more precisely, optparse.Option). that looks
like

class Option:
  def __init__(self, *opts, **attrs):
        do_something()


I want to do something in my __init__ and and also call Option.__init__.
Then I don't know how to pass the arguments. For example,

class MyOption:
   def __init__(self, *opts, **attrs):
        do_my_own_thing()
         Option.__init__(self, opts, attrs)

does not work (and you know why). I figured out some very ugly ways to do
this
but I believe there should be an elegant way to pass the argments to
superclass.







More information about the Python-list mailing list