Multiple hierarchie and method overloading

bruno at modulix onurb at xiludom.gro
Tue Apr 25 05:12:04 EDT 2006


Philippe Martin wrote:
> Hi,
> 
> I have something like this:
> 
> Class A:
>         def A_Func(self, p_param):
>          .....
> Class B:
>         def A_Func(self):
>          .....
> 
> Class C (A,B):
>         A.__init__(self)
>         B.__init__(self)
> 
> .....
> 
>         self.A_Func() #HERE I GET AN EXCEPTION "... takes at least 2 arguments (1
> given).

Ho, yes, also: A.A_Func() really takes 2 arguments (self, and p_param).
When called from an instance of A, the first argument (ie: self) will be
automagically feed with the instance itself - but you still have to pass
the second one.

> 
> I renamed A_Func(self) to fix that ... but is there a cleaner way around ?

Yes : passing the second argument.

-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list