Using IPython

IPython is basically an enhanced shell. It’s worth it just for the autocompletion alone, but there is much more. I like it too for all the magic commands that are built-in. Here are a few :

  • %cd — to change the current working directory
  • %edit — to open an editor and execute the code you typed in after closing the editor
  • %env — to show the current environment variables
  • %pip install [pkgs] — to install packages without leaving the interactive shell
  • %time and %timeit — to time the execution of Python code

Read the full list here.

Another useful feature is referencing the output of a previous command. In and Out are actual objects. You can use the output of the 3rd command by using Out[3].

Install IPython with:

$ pip3 install ipython

About the author

Erik is the owner of Python Land and the author of many of the articles and tutorials on this website. He's been working as a professional software developer for 25 years, and he holds a Master of Science degree in computer science. His favorite language of choice: Python!

Leave a Comment