0

I use a library that has a module with a function that has a bug. Consider the example below.

Content of module.py

def calculate_operation(x):
    return divide_by_two(x)

def divide_by_two(x):
    return x/0

Then when in my script I use calculate_operation(), it raises the obvious exception. I can define the divide_by_two(x) function in my script, but I wouldn't like to redefine the calculate_operation(x) because it is a large and complex function. I would like to know if there is any way I can tell calculate_operation to use my version of divide_by_two without having to redefine the first function or modify the module.py.

ivallesp
  • 1,914
  • 11
  • 17

0 Answers0