PY3.W0246

Useless Parent Delegation

Used whenever we can detect that an overridden method is useless, relying on parent or super() delegation to do the same thing as another method from the MRO.

Noncompliant Code:

Copy
class Animal:
  def eat(self, food):
    print(f"Eating {food}")
class Human(Animal):
  def eat(self, food):  # [useless-parent-delegation]
    super(Human, self).eat(food)

Compliant Code:

Copy
class Animal:
  def eat(self, food):
    print(f"Eating {food}")
class Human(Animal):
  """There is no need to override 'eat' it has the same signature as the implementation in Animal."""

The content on this page is adapted from the Pylint User Guide, Copyright ©2003-2022, Logilab, PyCQA and contributors. All rights reserved. https://pylint.pycqa.org/en/latest/index.html#, and is used under the Python Software Foundation License Version 2. Examples, recipes, and other code in the Pylint documentation are additionally licensed under the Zero Clause BSD License.