Friday, July 7, 2017

IPython or My Own Worst Enemy

IPython

When I started using bash many years ago I resisted using tab completion thinking that it would make me a lazy typist.  I didn't place as much emphasis on increasing my productivity.  I was doing system administration work and did not have the exact same environment on each system I was tasked with administrating.  Plain 'vi' was also my go-to editor over 'nvi' or 'vim' since it was the common denominator on my systems and syntax highlighting would only make me less "aware" of the code I was writing.  I guess I've always, in some regards, been a high-tech luddite.

Fast-forward to today.  I use bash tab completion quite a lot.  I even write my own completions for annoying commands that force me to do a lot of typing.  I use vim with spf13 and all sorts of eye candy and helpful features.  I still don't care for autopairs adding matching quotes, parens, and braces so I've disabled that plugin as well as a few others that get in my way.

I had played around with IPython a few times in the past but thought it too would make me dependent on a tool that I might not always have access to.  This seems to be a common concern I have.  I was just fretting this morning about using different keyboards on different laptops and computers that I use frequently, but that's another blog post.

Today I decided to give IPython another try.  Low and behold a couple of my biggest peeves about the basic CPython REPL have nice solutions.  Being able to edit multiline functions and loops without having to pull each line out of my history until I get to the point where I want to make a change is a very awesome feature.

Another feature I like is the magic commands that give me access to some common shell commands and the ability to edit a script without having to either put the REPL in the background and switch to the editor or close the REPL, edit the script, and reopen the REPL.  The latter looses all the state I may have built up during my previous REPL session.

I have only scratched the surface of what IPython provides but I'm glad I gave it another shot.