My Favourite Tool: IPython
This post originally appeared on the Software Carpentry website.
My favorite tool is … IPython.
IPython is a Python interpreter with added features that make it an invaluable tool for interactive coding and data exploration. IPython is most commonly taught via the Jupyter notebook, an interactive web-based tool for evaluating code, but IPython can be used on its own directly in the terminal as a replacement for the standard Python interpreter.
Why I like it
You can run Unix commands directly in IPython. For instance, if you want to load a file from another directory, it is convenient to
cd
into the directory from within the IPython window.IPython has an extensive tab autocomplete for function names, function arguments, file paths, and object names.
It comes equipped with “magic” commands: functions that assist in programming and that can be called with a single word starting with
%
.%paste
takes whatever is on your clipboard and formats it nicely so IPython can read it – useful for pasting in large blocks of code.%timeit
runs time tests and%lprun
runs line profiling automatically.The interpreter saves your command history across sessions. In case you close the window before you’re done, you can fire IPython back up and search through the history.
IPython makes it easy to test my code interactively, piece by piece.
– Kellie Ottoboni, PhD Candidate in Statistics, Berkeley
Have a favorite tool of your own? Please tell us about it!