arguments problem~

black quiteblack at yahoo.com
Thu Dec 25 04:07:48 CET 2003


Hi all~
 
i coded a class say named "A" which can receive arbitrary arguments and all works fine but problem came when i created another class "B" which inherited "A". it can not receive arguments as expected, ie it collected keywords arguments to nonekeywords arguments tuple and keep keywords dict empty. My destination is just to pass all keywords from A to B without any modification and same does nonekeywords. below is my code, I'd much appreciate if anyone could inspires me, thanx~
 
class A:
 def __init__(self, *args, **kw):
  print args
  print kw
  print
class B(A):
 def __init__(self, *args, **kw):
  A.__init__(self, args, kw)
a = A("a?", a_pro="a!")
b = B("b?", b_pro="b!")
 
you can see contents should be in kw of B was not in kw but args, how to fix it plz ?
 
Regards~
 



---------------------------------
Do you Yahoo!?
Free Pop-Up Blocker - Get it now
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20031224/0ec1bc6c/attachment.html>


More information about the Python-list mailing list