Say I have a variable named
choice it is equal to 2. How would I access the name of the variable? Something equivalent to
In : namestr(choice) Out: 'choice'
for use in making a dictionary. There’s a good way to do this and I’m just missing it.
The reason to do this is thus. I am running some data analysis stuff where I call the program with multiple parameters that I would like to tweak, or not tweak, at runtime. I read in the parameters I used in the last run from a .config file formated as
filename no_sig_resonance.dat mass_peak 700 choice 1,2,3
When prompted for values, the previously used is displayed and an empty string input will use the previously used value.
My question comes about because when it comes to writing the dictionary that these values have been scanned into. If a parameter is needed I run
get_param which accesses the file and finds the parameter.
I think I will avoid the problem all together by reading the .
config file once and producing a dictionary from that. I avoided that originally for… reasons I no longer remember. Perfect situation to update my code!