title: save variable to interactive namespace from python debugger
body: <p>When I am running inside an interactive session (in my case <code>ipython</code>), and am currently inside a debugger (<code>ipdb</code> or <code>pdb</code>) I would like to be able to put a variable into the main interactive namespace from within the debugging namespace.</p>
  
  <p>This is useful if my code crashes, but has already done significant work, some of which is salvageable to save time (for example, loading data from disk).</p>
  
  <p>so what I'd like is something like this, for example:</p>
  
  <pre><code>&gt;&gt;&gt; run -m my.module
  loading data from disk...
  done loading data.
  processing data...
  ---------------------------------------------------------------------------
  IndexError                                Traceback (most recent call last)
  ...
  </code></pre>
  
  <p>-> here something goes wrong during processing, but the loading of data worked fine... so I'd go into the debugger to check out what happened, and to see the <code>loaded_data</code>:</p>
  
  <pre><code>&gt;&gt;&gt; debug
  ipdb&gt; len(loaded_data)
  100000
  </code></pre>
  
  <p>-> Then I would like to be able to save this variable to the interactive namespace for use outside the debugger, like so:</p>
  
  <pre><code>ipdb&gt; save_to_interactive('loaded_data')
  ipdb&gt; exit
  &gt;&gt;&gt; len(loaded_data)
  100000
  </code></pre>