I have a lot of functions like the following, which recursively call themselves to get one or many returns depending on the type of the argument:
def get_data_sensor(self, sensorname):
if isinstance(sensorname, list):
return [get_data_sensor(self, sensor) for sensor in sensorname]
return get_data(os.path.join(self.get_info("path"), "{0}.npy".format(sensorname)))
I would like to call my function recursively without having to know my current function name, I don't want to have my function name twice in the code to limit copy-paste error.
Determine function name from within that function (without using traceback) shows how to get the actual function name, but I need the function itself to call it.