how to pass keyword arguments to derived class~
sdd
daniels at dsl-only.net
Thu Dec 25 11:02:59 EST 2003
black wrote:
> ...
> 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=kw)
class C(A):
def __init__(self, *args, **kw):
A.__init__(self, *args, **kw)
> a = A("a?", a_pro="a!")
> b = B("b?", b_pro="b!")
c = C("c?", c_pro="c!")
Suggestion:
Really use the standard python convention of 4 characters per indent.
We promise not to charge you for extra spaces. This code was a trifle
harder to cut out of the message and paste into idle to replicate. It
also does help in reading code to trust there are no subtle indents.
-Scott David Daniels
Scott.Daniels at Acm.Org
More information about the Python-list
mailing list