ancestor class' __init__ doesn't call other methods

Luis P. Mendes luis_lupe2 at netvisao.pt
Fri Sep 15 23:03:56 CEST 2006


Rob De Almeida escreveu:
> Luis P. Mendes wrote:
>> Method a() is not called.  Why is this?  What is the best option to
>> solve this? Have Cotacoes returning values and not to be an ancestor
>> class of CruzaEmas?
> 
> It works for me, after rearranging your code a little bit:
> 
Ok, thanks. I already know where the problem was.

The a() method was just an example.  The real problem was elsewhere.

I had two methods with the same name, one at Cotacoes (the ancestor),
another one at CruzaEmas.

The method called at the __init__ of the ancestor was the one of the
daughter class, and not the one of the ancestor's, as I was expecting.
After changing the name of the latter, everything seems to be fine.

Luis P. Mendes



More information about the Python-list mailing list