[Tutor] list of functions

kay Cee unee0x at gmail.com
Wed Mar 29 17:23:33 EDT 2017


Greetings all,

I would like to use a list of functions for an automation project, and this
is the prototype I came up with
###########################
def func1():
print('func1')

def func2():
print('func2')

def func3():
print('func3')


func_list = ('func1', 'func2', 'func3')

for f in func_list:
eval(f)()
#############################

The output shows as intended, but I'd like to know if there are any safety
or performance issues using this prototype or if there is a better way to
acheive a list of functions.

Thanks in advance


More information about the Tutor mailing list