0

In python, what is the difference between the two BaseClass initialisation statements below, and which is better? They seem to yield the same result?

class BaseClass(object):
    def __init__():
        pass

class MyClass(BaseClass): 
    def __init__(self):
        BaseClass.__init__(self)
        super(MyClass, self).__init__()
Ammar Akhtar
  • 1,698
  • 3
  • 13
  • 25
  • to sum up: it's a more powerful way to refer to parent classes in a complex multiple inheritance context, as well as a nicer way to refer to parent constructors, which gets even better in python 3.0 – zmo Jan 29 '14 at 11:42
  • @zmo - to clarify you mean using the super() method? – Ammar Akhtar Jan 29 '14 at 12:18
  • indeed that's what I meant – zmo Jan 29 '14 at 12:50

0 Answers0