I have a file, which defines
def foo(x):
   return round(x)
Here round is the python built-in function.
Now, I would like to call this function with a numpy array. Numpy has a round function, too. Unfortunately, there are issues (e.g. #11557)
import numpy as np
foo(7.6)
foo(np.array([7.6]))       # works with python2 + np_1.14.0, not with 3.6.9 + np_1.14.5
foo(np.array([7.6, 8.9]))  # TypeError: type numpy.ndarray doesn't define __round__ method
Are there possibilities to replace the function round with np.round inside the foo function? Some patch like round = np.round before import or foo.round = np.round after import?
Edit: I'm looking for a solution without modifing the file.
 
    