#! /usr/bin/python3 # =================================================================== # test an array of functions # =================================================================== def funca(str): print(f'funca {str}') def funcb(str): print(f'funcb {str}') a = [ funca, funcb ] # array (list) of functions a[0]('abc') # execute function a[0] a[1]('xyz') # execute function a[1] f = a[0] # function a[0] f('ABC') # execute function a[0] f = a[1] # function a[1] f('XYZ') # execute function a[1]