title: Storing lambdas in a dictionary
body: <p>I have been trying to create a dictionary with a string for each key and a lambda function for each value.  I am not sure where I am going wrong but I suspect it is either my attempt to store a lambda in a dictionary in the first place, or the fact that my lambda is using a shortcut operator.</p>
  
  <p>Code:</p>
  
  <pre><code>dict = {
      'Applied_poison_rating_bonus': 
          (lambda target, magnitude: target.equipmentPoisonRatingBonus += magnitude)
  }
  </code></pre>
  
  <p>The error being raised is <code>SyntaxError: invalid syntax</code> and pointing right at my <code>+=</code>.  Are shortcut operators not allowed in lambdas, or am I even farther off track than I thought?</p>
  
  <p>For the sake of sanity, I have omitted hundreds of very similar pairs (It isn't just a tiny dictionary.)</p>
  
  <p>EDIT:</p>
  
  <p>It seems my issue was with trying to assign <em>anything</em> within a lambda expression.  Howver, my issue to solve is thus how can I get a method that only knows the key to this dictionary to be able to alter that field defined in my (broken) code?</p>
  
  <p>Would some manner of call to eval() help?</p>
  
  <p>EDIT_FINAL:</p>
  
  <p>The functools.partial() method was recommended to this extended part of the question, and I believe after researching it, I will find it sufficient to solve my problem.</p>