how to pass keyword arguments to derived class~

black quiteblack at
Thu Dec 25 12:36:16 CET 2003

Hi all~
    I met problem when trying passing keyword arguments to derived class. my goal is to pass all keyword arguments to taht derived class as they did for superclass, but the result was not exactly what i want. below is my code:
class A:
 def __init__(self, *args, **kw):
  print args
  print kw
class B(A):
 def __init__(self, *args, **kw):
  A.__init__(self, args, kw=kw)
a = A("a?", a_pro="a!")
b = B("b?", b_pro="b!")
here is the output:
('a?', )
(('b?', ), )               # I want to get simply ('b?', ) here
{'kw':{'b_pro':'b!'}}    # Here should also be ('b_pro':'b!')
any help ???

Do you Yahoo!?
Free Pop-Up Blocker - Get it now
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list