Ex42 - super() vs super(Employee, self)

I have two questions regarding the use of super() in python3.

  1. Consider the following class definition from ex42

    class Employee(Person):
       def __init__(self, name, salary):
       # the following two do the same
       # super(Employee, self).__init__(name)
       super().__init__(name)
       ## Employee has-a salary
       self.salary = salary
    

As of the python documentation here the two following lines of code do the same thing

   super(Employee, self).__init__(name)
   super().__init__(name)

I tried it and at least it seems to work the same way.

My question is then, shouldn’t we use the second option

super().__init__(name)

in order not to violate the D.R.Y Don’t repeat yourself principle see here ?

  1. My second question is that I read in the article above that the new syntax super() is equivalent to super(__class__, <firstarg>) where __class__ is the class where the method was defined in. But in our example above this would be equivalent to super(Person, self) which contradicts what I wrote under 1. Can anyone clarify this?

Thanks

Yes that is correct, but Python says you should be explicit so I guess the first one is more appropriate. However I disagree with that and now that you can use the second one I think you should go with that.