title: How to assign member variables temporarily?
body: <p>I often find that I need to assign some member variables temporarily, <em>e.g.</em></p>
  
  <pre><code>old_x = c.x
  old_y = c.y
  # keep c.z unchanged
  
  c.x = new_x
  c.y = new_y
  
  do_something(c)
  
  c.x = old_x
  c.y = old_y
  </code></pre>
  
  <p>but I wish I could simply write</p>
  
  <pre><code>with c.x = new_x; c.y = new_y:
      do_something(c)
  </code></pre>
  
  <p>or even</p>
  
  <pre><code>do_something(c with x = new_x; y = new_y)
  </code></pre>
  
  <p>Can Python's decorators or other language features enable this kind of pattern? (I could modify <code>c</code>'s class as needed)</p>