title: Can I put a breakpoint in a running Python program that drops to the interactive terminal?
body: <p>I'm not sure if what I'm asking is possible at all, but since python is an interpreter it might be. I'm trying to make changes in an open-source project but because there are no types in python it's difficult to know what the variables have as data and what they do. You can't just look up the documentation on the var's type since you can't be sure what type it is. I want to drop to the terminal so I can quickly examine the types of the variables and what they do by typing help(var) or print(var). I could do this by changing the code and then re-running the program each time but that would be much slower.</p>
  
  <p>Let's say I have a program:</p>
  
  <pre><code>def foo():
      a = 5
      my_debug_shell()
      print a
  
  foo()
  </code></pre>
  
  <p>my_debug_shell is the function I'm asking about. It would drop me to the '>>>' shell of the python interpreter where I can type help(a), and it would tell me that a is an integer. Then I type 'a=7', and some 'continue' command, and the program goes on to print 7, not 5, because I changed it.</p>