how to get variable's name?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/12189000/how-to-write-a-function-to-return-the-variable-name-in-python">How to write a function to return the variable name in Python</a>  </p>
</blockquote>



<p>Get variable's value is easy, but how to get variable's name?</p>

<p>For example, I have a module which contains some variable A,B,C,D...Z</p>

<p>In local scope, I want to set local vars to the module, I want to write code like this:</p>

<pre><code>for lvar in [A,B,C,D...Z]:
   setattr(module, var's name, lvar)
</code></pre>

<p>Seem's like an impossible mission in other language I used. Since it assign to the list, it keeps value but not the name. I'll have to write like this:</p>

<pre><code>module.A = A
module.B = B
module.C = C
module.D = D
module.E = D
module.F = F
module.G = G
module.H = H
</code></pre>

<p>Edit.i wouldn't name it in ABCD in real world, this is just an example</p>
