I have a few functions that do basically the same task but using different algorithms. Since these algorithms are all related (they belong to the same parent process) I’ve organized them in my package my_package
as methods of an empty class as so:
class my_empty_class:
"""Define an empty class to hold the methods"""
def func1(param1, param2, param3):
# algo 1
return results
def func2(param1, param3):
# algo 2
return results
def func3(param2, param4):
# algo 3
return results
which I then call with:
import my_package
res1 = my_package.my_empty_class.func1(param1, param2, param3)
res2 = my_package.my_empty_class.func2(param1, param3)
res3 = my_package.my_empty_class.func3(param2, param4)
Is this bad practice? Because it works, but it feels like it is. Is there maybe a better/more recommended way to go about this?
2