Some notes that I scribbled over ipython:
Use %magic functions. %paste for pasting code that has been indented in a foreign environment. Actually the “%” here can be skipped. Some other examples are: run <script_name.py>, pwd, cd <dir_name> and some other shell commands as well. Shell commands can be run by using ! as prefix.
%timeit for easy profiling.
%run to execute the scripts in the current namespace.
<func_name>, <module_name> followed by ? or ?? return documentation and even source code. Out[n] provides the results for the previous expressions.
After a program or script has crashed, %debug takes you back to the line where it failed in the debug mode. %pdb will also do the same but before running the program or script.
%pdef, %pdoc, %edit, pdb.run() profile.run(), !echo “Hello {<python_var>}”, CTRL+p CTRL+n, CTRL+r and finally %lsmagic.
Ending is a bit abrupt as I had to salvage this post. So I only left the keywords in.
Leave a Reply