modifying inherited methods

Thomas Wouters thomas at xs4all.net
Fri May 19 06:34:09 EDT 2000


On Fri, May 19, 2000 at 11:14:51AM +0100, Robin Becker wrote:
> In article <39250B93.4710EB86 at muc.das-werk.de>, Thomas Thiele
> <thiele at muc.das-werk.de> writes
> >Oh, sorry I misunderstand you.
> >
> >But the other thing is easy as well.
> >
> >class A:
> >    def __init__(self, a,b,c,d):
> >        .....
> >
> >class B(A):
> >    def __init__(self, a,b):
> >        c = <defaultc>
> >        d= <defaultd>
> >        A.__init__(self, a,b,c,d)
> >
> >
> >
> yes the only problem is when A.__init__ has a lot of arguments
> and you don't want to cut and paste these to a bunch of inheriting
> class methods.

Use *args, **kwargs and apply().

-- 
Thomas Wouters <thomas at xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!




More information about the Python-list mailing list