I have one function that is used to compute distances of an object in 3 different ways.
Is one of the following two methods considered better practice:
Creating 3 different functions, one each for calculating a type of distance
Creating one single function with multiple if-else statements?
I am using python, and have observed a number of libraries using a 'mode' parameter in order to allow for similar kinds of functionality but with different calculations, for example the convolution function in scipy: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.convolve2d.html. Here, the operation being done is always convolution, but the mode determines the type of convolution.