I was reading some Python code in a private repository on GitHub and found a class resembling the one below:
class Point(object):
'''Models a point in 2D space. '''
def __init__(self, x, y):
super(Point, self).__init__()
self.x = x
self.y = y
# some methods
def __repr__(self):
return 'Point({}, {})'.format(self.x, self.y)
I do understand the importance and advantages of using the keyword super
while initialising classes. Personally, I find the first statement in the __init__
to be redundant as all the Python classes inherit from object
. So, I want to know what are the advantages(if any) of initializing a Point
object using super
when inheriting from the base object
class in Python ?