I have many variables I want to perform the same function on. The return value of the function should be saved in a variable with the the letter m appended to it. I'm currently using a dictionary but I'm having trouble converting the key value pair to a variable name with that pair. I'm listing my approach below and I'm opening to either appending/adding on to this method or using a better method all together
A=4
B=5
C=6
listletter = {'mA':A,'mB':B,'mC':C}
for key in listletter :
listletter[key]=performfunc(listletter[key])
Note that I do not want to use the dictionary to reference values. My actual use of the variables is in numpy and they're is already alot of indexing going on and the lines are long. I therefore want distinct variable names as opposed to dict['variablename'][][]...
I am aware of the exec function but I here this is bad convention. I'd also appreciate any general advice on simple improvements unrelated to the task(perhaps I should use key, value instead?).
EDIT: I would also be okay with simply performing the function on the variables but not appending the letter m to it. I want to perform the same function on a, b and c. The function would return the new values of a,b and c. Once again I ultimately want to access the variables as a,b & c and not through a dictionary