Addressing the question for variable variables in python (i.e. variables with variable names), which has been posed on stackoverflow: http://stackoverflow.com/questions/1373164/how-do-i-do-variable-variables-in-python
The consensus is to use a dictionary for this. This is a good idead, however, there are many aspects arising from this:
* you'll yourself be responsible for this dictionary, including garbage collection (of in-dict variables) etc.
* there's no locality for variable variables, all are global within the dictionary, unless you locally define different dictionaries for this purpose
* you are more flexible, e.g. you can decide to overwrite existing variables or, alternatively, to raise an exception on overwriting (e.g. for const variables)
* if you want to rename a variable name, you'll have to do it manually
* ...
Please Find some examples in the Wiki
Python Variable Variables Manager
a python manager class for named variables (variable name is variable)
Brought to you by:
domsen
Downloads:
0 This Week
Windows
Mac
Linux
BSD
ChromeOS