I have the following code. What would be the best way to evaluate the command variable and the parameters it contains.
This is a contrived example, but the easiest way to explain what I am trying to do on a bigger scale.
class Job():
def random_number(self, start, end, prec=0):
number = round(random.uniform(start,end),prec)
if(prec == 0):
return int(number)
return number
def run(self, command):
#command = "self.random_number(1,10,0)"
#**************
# What would be the best way to 'eval' the content of the 'command' variable and the parameters it contains?
#**************
job = Job()
job.run("self.random_number(1,10,0)")