IPython3 provides a series of advantages over the standard Python shell - in particular with regard to scientific computing. A good start is too look into the IPython documentation. Start by making sure it is properly installed:
$ sudo apt install ipython3 python3-ipdb ipython3-qtconsole ipython3-notebook
IPython can be started via eg.
$ ipython3 $ ipython3 qtconsole --pylab=inline $ ipython3 notebook --pylab=inline
However, I prefer adding an alias to start it with less typing. This can, for example, be achieved by
$ echo "alias i='ipython3'" >> ~/.bashrc
One of IPython's key features are so-called magic functions. They are helpful when Python would not be natural / straight-forward in solving a problem. Examples include %cpaste, %paste and . Refer to the documentation (%quickref) for more. It is possible to obtain help for the magic functions by appending a ? directly after their name.
script.py-d enables the debugger); -p -s cumulative runs the script with profiling enabled.statementstatementIPython's integrated debugger. Allows inspecting the status of variable by simply typing their name. Should their name overlap with a debugger command, the latter takes precedence. To be able to still access the variable, type
!varname
Inside the debugger, simply type h for help. If you have trouble getting out of the debugger, the following should help
import os os._exit(0)
For debugging a function available inside ipython, the following snipped (kudos to Wes McKinney) will be helpful
def debug(f, *args, **kwargs):
from IPython.core.debugger import Pdb
pdb = Pdb(color_scheme='Linux')
return pdb.runcall(f, *args, **kwargs)