FastML

Machine learning made easy

Why IPy: reasons for using IPython interactively

IPython is known for the notebooks. But the first thing they list on their homepage is a “powerful interactive shell”. And that’s true - if you use Python interactively, you’ll dig IPython.

Here are a few features that make a difference for us:

  • command line history and autocomplete
    These are basic shell features you come to expect and rely upon after a first contact with a Unix shell. The standard Python interpreter feels somewhat impoverished without them.

  • %paste
    Normally when you paste indented code, it won’t work. You can fix it with this magic command.

  • other %magic commands
    Actually, you can skip the %: paste, run some_script.py, pwd, cd some_dir

  • shell commands with !
    For example !ls -las. Alas, aliases from your system shell don’t work.

  • looks good
    Red and green add a nice touch, especially in a window with dark background.

If you have a light background, use %colors LightBG

Share your favourite features in the comments. For more, see Using IPython for interactive work.

Comments