Skip to content

super-without-brackets (PLW0245)#

Derived from the Pylint linter.

Fix is always available.

This rule is unstable and in preview. The --preview flag is required for use.

What it does#

Checks for super calls without parentheses.

Why is this bad?#

When super is used without parentheses, it is not an actual call, and thus has no effect.

Example#

class Animal:
    @staticmethod
    def speak():
        return "This animal says something."


class Dog(Animal):
    @staticmethod
    def speak():
        original_speak = super.speak()
        return f"{original_speak} But as a dog, it barks!"

Use instead:

class Animal:
    @staticmethod
    def speak():
        return "This animal says something."


class Dog(Animal):
    @staticmethod
    def speak():
        original_speak = super().speak()
        return f"{original_speak} But as a dog, it barks!"