I want to ask the user for inputs then store all inputs into a list. The inputs are going to be exactly the same spelling as the functions that I've defined.
inp = raw_input("functions you want to execute, sep by commas:")
alist = []
for j in inp.split(','):
alist.append(j)
def func1():
print 'FUNCTION 1'
def func2():
print 'FUNCTION 2'
def func3():
print 'FUNCTION 3'
for i in alist:
eval(i+'()') #I want to do this but all at the same time
In this case, when asked for input, and I want all 3 functions to be executed, the list is going to look like this:
['func1','func2','func3']
What I want to do is to execute them all at the same time.
I have considered multiprocessing, but I don't know how to do it from a list.
Also, please do not lecture me about my usage of eval(), this code is for molecular dynamics simulation.