Hi!

I have two super classes:

class SuperClass1(object):
    def __init__(self, word):
        print word

class SuperClass2(object):
    def __init__(self, word, word2):
        print word, word2

Also I have subclass of these classes:

class SubClass(SuperClass1, SuperClass2):
    def __init__(self):
        pass

I have two questions.
1) Inside __init__ of SubClass how can I firstly call __init__ of
SuperClass1, and then __init__ of SuperClass2, using builtin super()
function.
2) Why should I use super() at all, if it is very easy to call methods
of super class like this:
class SubClass(SuperClass1, SuperClass2):
    def __init__(self):
        SuperClass1.__init__(self, 'Python')
        SuperClass2.__init__(self, 'Hello', 'world')

Thanks in advance.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to