When you are working with a task where you are interactively building a solution, you need a lot of focus. Most of the work that I do fits into this category. Interactively building solutions to larger problems by solving smaller problems is pioneered by data first tools like Clojure and R.

The first step to achieving the focus required in such interactive work is to remove distractions and complexities from your environments as much as possible. For example, Emacs enables running shell commands while you are editing some other file, thereby reducing the cognitive load of switching to another window/terminal.

I was not aware of full set of feature of IPython project, especially its shell command running abilities and magic commands related to timing and profiling. I think these capabilities can make your coding workflow a lot better. For example, debugging, time and memory profiling, running shell commands, using output of shell commands as variables can all be tried inside IPython shell. This can help you reduce context switching by a large amount.

You can get a good enough introduction to IPython capabilities by reading free first chapter of book ‘Python Data Science Handbook’ by Jake VanderPlas.