bad-super-call / E1003#
Bad first argument %r given to super()
Used when another argument than the current class is given as first argument of the super builtin.
class Animal: pass class Tree: pass class Cat(Animal): def __init__(self): super(Tree, self).__init__() # [bad-super-call] super(Animal, self).__init__()
class Animal: pass class Tree: pass class Cat(Animal): def __init__(self): super(Animal, self).__init__()
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
One exception is calling
super() on a non-direct parent class. This can be used to get a method other than the default
method returned by the
Created by the newstyle checker.