Python etc / ipython

ipython

IPython is an alternative interactive shell for Python. It has syntax highlighting, powerful introspection and autocomplete, searchable cross-session history, and much more. Run %quickref in IPython to get a quick reference on useful commands and shortcuts. Some of our favorite ones:

  • obj? - print short object info, including signature and docstring.
  • obj?? - same as above but also shows the object source code if available.
  • !cd my_project/ - execute a shell command.
  • %timeit list(range(1000)) - run a statement many times and show the execution time statistics.
  • %hist - show the history for the current session.
  • %run - run a file in the current session.