Asked • 04/16/19

Understanding Python super() with __init__() methods?

I'm trying to understand the use of `super()`. From the looks of it, both child classes can be created, just fine. I'm curious to know about the actual difference between the following 2 child classes. class Base(object):  def __init__(self):   print "Base created"    class ChildA(Base):  def __init__(self):   Base.__init__(self)    class ChildB(Base):  def __init__(self):   super(ChildB, self).__init__()    ChildA() ChildB()

1 Expert Answer


Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.