IPython Notebook lets you do more than just program

Slashdot it! Delicious Share on Facebook Tweet! Digg!

Helping Hands

The list of attractive qualities for IPython Notebook is long. Highlights include the possibility for measuring runtime performance of program parts as well as profiling. Figure 7 shows how %timeit measures how long Python needs to execute a line. The %%timeit version works on all of the lines in a cell, as do all magic commands with two percent symbols. The %prun add(1, 1) command is used to start the Python profiler, cProfile , which shows what resources are consumed by each function.

Figure 7: Convenient measurements of runtime with one line of code.

If you would like to figure out how another version of Python or a completely different programming language might solve a particular task, you can stay inside the notebook. The %%python2 command turns a line into a Python2 program. This lets you try out Python2 code in a Python3 notebook. Of course, this also works in reverse. Additional languages such as Perl, LaTeX, JavaScript, and even Fortran are also ready to use when a cell is appropriately marked.

IPython Notebooks can be exported to static HTML pages and also to Python source text files. The accompanying converter supports many more formats. You can also create lecture slides with IPython Notebook. This is, of course, a very interesting exercise for slides prepared for a lecture on Python because you can directly test code examples and even have syntax coloring available as part of the presentation.


IPython Notebook has supported other programming languages in addition to Python for a long time. The number of supported languages is about 30. All of the language independent parts of the project are named Jupyter. The IPython team is currently focused on building in new functionality. The main goals are a real-time collaboration capability for developers similar to Google Docs. Software creation of GUI input elements is also getting lots of attention. Based on the speedy rate at which previous development efforts have been completed, you can look forward to much new functionality in the next few years.

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $0.99
(incl. VAT)

Buy Ubuntu User

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content