title: How to assign a class variable "dynamically" in Python?
body: <p>I have the following code :</p>
  
  <pre><code>class Potion(object):
      def __init__(self,name,var,varamount):
          self.name=name
          self.var=var
          self.varamount=varamount
  
  class Inventory(object):
      def __init__(self):
          self.items={}
      def use_potion(self,potion):
          potion.var+=potion.varamount
          print("Used a ",potion.name," !")
  
  class Player():
      def __init__(self):
          self.health=100
          self.mana=100
          self.stamina=100
  
  inventory=Inventory()
  player=Player()
  healthpotion=Potion("Health potion",player.health,50)
  inventory.use_potion(healthpotion)
  </code></pre>
  
  <p>Here, my health potion is supposed to add 50 to the variable <code>player.health</code>.
  But <code>player.health</code> remains unchanged, only <code>healthpotion.var</code> is changed.
  Assuming I want different types of potions (stamina, mana, health), how can I dynamically assign <code>player.health</code>, <code>player.stamina</code> and <code>player.mana</code> to <code>potion.var</code> ?</p>