I wanted to do Ruby's binding.pry
in Python as well.
# coding: utf-8
from IPython import embed
from IPython.terminal.embed import InteractiveShellEmbed
n = 1
print('start embed')
embed()
# === ipython interactive shell ===
#
# print(n)
# => 1
#
# n += 1
#
# Ctrl + D : exit ipython
print('end embed')
ipshell = InteractiveShellEmbed()
print('start interactive shell')
ipshell()
# === ipython interactive shell ===
#
# print(n)
# => 2
#
# Ctrl + D : exit ipython
print('end interactive shell')
It was useful information. It's short, but that's it from here.
http://ipython.org/ipython-doc/2/interactive/reference.html#embedding