Python

Python

By DeepSource

Function or method is being redefined PYL-E0102

Bug risk

A function, method or class is being redefined in the same scope. This would override the original definition, and doing this is strongly discouraged. Please verify that this is something that you intended to do. Redefining anything can lead to confusion, decreases code readability and may cause bugs that are difficult to diagnose. It is recommended either to refactor the function/method/class, or choose different names.

Bad practice

def calc(x, y):
    return x + y


def calc(x, y):
    return x * y

Recommended

def calc_sum(x, y):
    return x + y


def calc_product(x, y):
    return x * y