bad-super-call / E1003#

Message emitted:

Bad first argument %r given to super()

Description:

Used when another argument than the current class is given as first argument of the super builtin.

Correct code:

class Animal:
    pass


class Cat(Animal):
    def __init__(self):
        super().__init__()

Problematic code:

class Animal:
    pass


class Cat(Animal):
    def __init__(self):
        super(Animal, self).__init__()  # [bad-super-call]

Additional details:

In Python 2.7, super() has to be called with its own class and self as arguments (super(Cat, self)), which can lead to a mix up of parent and child class in the code.

In Python 3 the recommended way is to call super() without arguments (see also super-with-arguments).

Related links:

Created by the newstyle checker.