This thread discusses how to get the name of a function as a string in Python: How to get a function name as a string?
How can I do the same for a variable? As oppose
For constants, you can use an enum, which supports retrieving its name.