In Python 3, I have the following code:
class A:
def __init__(self):
pass
class B(A):
def __init__(self):
super().__init__()
This yields the Pylint warning:
- Old-style class defined. (old-style-class)
- Use of super on an old style class (super-on-old-class)
In my understanding, in Python 3 there does not exist an old-style class anymore and this code is OK.
Even if I explicitly use new-style classes with this code
class A(object):
def __init__(self):
pass
class B(A):
def __init__(self):
super().__init__()
I get Pylint warning because of the different syntax to call the parent constructor in Python 3:
- Missing argument to super() (missing-super-argument)
So, how can I tell Pylint that I want to check Python 3 code to avoid these messages (without disabling the Pylint check)?
According to this list 'Missing argument to super()' has code E1004: .If you want to disable only one type of warning you can add this line at the beginning of the file:
# pylint: disable=E1004
Or you can try calling super()
like this:
class B(A):
def __init__(self):
super(B, self).__init__()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With