Functions are first class objects. So like this:
def do_this():
print "In do_this"
def do_that():
print "In do_that"
dct = [do_this, do_that]
dct[0]()
If you really want to call them from a list of strings, you can use globals ():
dct = ['do_this', 'do_that']
globals()[dct[0]]()
But I would suggest that using globals () (or locals ()) is probably not the right way to solve your problem. Grok python path:>>> import this
source
share