Skillversitas

IPython Introduction

IPython is an enhanced interactive Python interpreter created by Fernando Pérez in 2001. While the standard Python shell reads a single expression, prints the result, and waits for the next one, IPython wraps that loop in a richer environment: tab completion, syntax highlighting, persistent history, object introspection, and a system of magic commands. It is the engine beneath every Jupyter kernel session, so everything you learn here transfers directly to notebooks.

Why Not the Standard Shell?

The plain interpreter gives you genuine Python objects for results, but it shows their string representation only. IPython improves the loop in several practical ways:

  • Numbered prompts such as In [1]: and Out[1]: keep track of your session and let you retrieve earlier input and output.
  • Tab completion works on variables, methods, keyword arguments, files, and magic commands.
  • Introspection — a question mark after any object prints its docstring, signature, and source file.
  • Shell access — commands prefixed with ! run in the operating system shell, and results land in Python variables.
  • One-click upgrades of previous results through output caching such as _5 or Out[5].

A First Session

Start IPython and try a few lines. Prompt numbers confirm the session state is preserved:

In [1]: import numpy as np

In [2]: data = np.random.default_rng(1).normal(size=1000)

In [3]: data.mean()?
Object: method mean of numpy.ndarray
Docstring: Returns the average of the array elements.

In [4]: round(data.mean(), 3)
Out[4]: np.float64(0.019)

Features in Brief

Beyond the basics, IPython offers control over the prompt and output formatting, a rich configuration system through profile files, and macros that replay recorded input. Magic commands beginning with % act as mini-programs inside the interpreter — %timeit benchmarks a statement, %run executes a script, and %who lists interactive variables. Embedding behavior matters too: IPython can be embedded inside any application to give it a powerful Python console.

Because it is implemented as a Python library, IPython stays out of your way when you do not need it; every ordinary Python line works exactly as before. The shell simply adds a layer of convenience on top of the language you already know.

Summary

IPython is a feature-rich interactive Python server and REPL that adds numbered I/O caching, introspection, completion, and magics on top of standard Python — and it powers every Jupyter kernel.