ancestor class' __init__ doesn't call other methods

Luis P. Mendes luis_lupe2 at
Fri Sep 15 21:02:45 CEST 2006


I have the following problem:

I instantiate class Sistema from another class.  The result is the same
if I import it to interactive shell.

s = Sistema("par")

class Sistema:
    def __init__(self, par):
        cruza_ema = CruzaEmas(par)

class CruzaEmas(Ema, Cotacoes):
    def __init__(self, par):
        Cotacoes.__init__(self, par)  <- calls ancestor class' __init__

class Cotacoes:
    def __init__(self, par):
        print "par: ", par
    def a(self):			<- just as an example
        print "ffffffffffffff"

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?

More information about the Python-list mailing list