0

I would like to call the __init__ method of the superclass. Here are two way I can think of:

super().__init__(some_arg)  # I am using Python 3

# or like this:
MyBaseClass.__init__(self, some_arg)

What is the preferred way of doing it?

Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555
Ugur
  • 1,914
  • 2
  • 25
  • 46

1 Answers1

0
super().__init__(*args, **kwargs)   

Perceive you don't pass the "self" - it is inserted automatically.

Super() was first designed in Python 2 to allow classes to be reused as mixins in a class hierarchy in a way that their immediate superclass may change,

jsbueno
  • 99,910
  • 10
  • 151
  • 209