title: Changing a variable inside a class
body: <p>I'm programming a text field class for a game.
  It's supposed to change a string from outside the class to the string the user enters. 
  The following is pseudo-code, but you should understand my problem :D</p>
  
  <pre><code>class txtfield(pygame.sprite.Sprite):
      def __init__(self, var, name, x, y):
          self.var=var
          self.value=""  
  
  
      def update(self, key):
          #I removed image-changing and the code which changes the string self.value 
          #key is a character from the last pressed button
          #(self.value+=key)
          if key=="return":
              self.var=self.value
              # I want this to be like 'a=self.value'.
              #-&gt; assuming self.name is 'Peter', 'a' should change to 'Peter' 
              #if the user hits enter
  
  a="NAME"
  txt=txtfield(a, "popo", 20, 20)
  </code></pre>
  
  <p>I just want <code>txtfield</code> to change the variable <code>a</code>, but apparently that's not working the way I do it.</p>