Is there a way to convert a list of function or definition names (strings) into a dictionary based lookup table where the key is the definition name and the value is the definition class that corresponds to the name (the definition name is the name given). It has been said that the safest way is to use the lookup table approach (dictionary mapping) such as here. However, the situation is such that the list of definition names is variable and the user/programmer is not able to directly write it into the code but rather it has to be added programmatically.
So how can I do effective the following:
nameList = ['methodName1','methodName2','methodName3','methodName4']
methodLookup = {}
for name in nameList:
methodLookup.update({name:name.strip('\'')})
Where the dictionary value is the function not the string.
Something similar in essence to but the opposite of the following:
for var, val in dictionary.items(): exec(var + ' = val')