I use this very helpful macro when developing in C++:
#define DD(a) std::cout << #a \" = [ \" << a << \" ]\" << std::endl;std::cout.f
You can't get a variable (well, object)'s name in python. But you can pass the object's name to get its value (kinda the opposite of what you do with that macro)
>>> a=4 >>> locals()['a'] 4
EDIT: a detailed explanation may be found here