I would like to be able to get the name of a variable as a string but I don\'t know if Python has that much introspection capabilities. Something like:
>&
Are you trying to do this?
dict( (name,eval(name)) for name in ['some','list','of','vars'] )
Example
>>> some= 1 >>> list= 2 >>> of= 3 >>> vars= 4 >>> dict( (name,eval(name)) for name in ['some','list','of','vars'] ) {'list': 2, 'some': 1, 'vars': 4, 'of': 3}