title: Python (pdb) - Queueing up commands to execute
body: <p>I am implementing a "breakpoint" system for use in my Python development that will allow me to call a function that, in essence, calls pdb.set_trace();</p>
  
  <p>Some of the functionality that I would like to implement requires me to control pdb from code <em>while</em> I am within a set_trace context.</p>
  
  <p>Example:</p>
  
  <pre><code>disableList = []
  def breakpoint(name=None):
      def d():
          disableList.append(name)
          #****
          #issue 'run' command to pdb so user
          #does not have to type 'c'
          #****
  
      if name in disableList:
          return
  
      print "Use d() to disable breakpoint, 'c' to continue"
      pdb.set_trace();
  </code></pre>
  
  <p>In the above example, how do I implement the comments demarked by the <code>#****</code> ?</p>
  
  <p>In other parts of this system, I would like to issue an 'up' command, or two sequential 'up' commands without leaving the pdb session (so the user ends up at a pdb prompt but up two levels on the call stack).</p>