IPython is an
enhanced interactive Python interpreter, offering
tab completion, object introspection, and much more. It's running on the right-hand side of this page, so you can try it out right now.
Here's a quick micro-tutorial to get you started with some of the fun stuff it provides:
- Type
imp
then tab to get
import
then type nu
and tab
to see which modules you can import that start with
'nu'.
- Import numpy and type
numpy?
to get the full
documentation for the numpy
module. q
exits the documentation view.
- Try
%time numpy.random.rand(1000, 1000).max()
to see
how long it takes to calculate the maximum of a million numbers.
- Type
a = 15
and return. Note down the line number (it's in the square brackets in front of the line).
- Now type
%save set_a.py line number
to save that line to a file.
To find out more about the save magic function, you can
type %save?
- Change the value of a:
a = 37
- Use
%run set_a.py
to get the old value of a back. Just typing a
at the prompt will display its value.
%edit set_a.py
will open vi to edit the file. If you're a vi user, you can edit to your heart's content. Otherwise, just type :q
to exit and return to IPython.
That's it for our quick tour. To find out more about IPython, visit the
project's homepage,
or read the full tutorial.
This page is powered by PythonAnywhere, an online Python development and hosting environment. Click here to find out more.