SoFunction
Updated on 2024-11-19

Difference between ipython and python in detail

Introduction to ipython

IPython is an interactive shell for python, much better than the default python shell, supports variable auto-completion, auto-indentation, bash shell commands, and has a lot of useful built-in features and functions.

IPython is based on the BSD open source.

IPython provides a rich architecture for interactive computing, containing:

Powerful interactive shell

Jupyter kernel

Interactive data visualization tools

Flexible, embeddable interpreter

Easy-to-use, high-performance parallel computing tools

The developers of IPython have absorbed the basic concepts of the standard interpreter and built upon them to create an amazing tool. On its home page it says: "This is an enhanced interactive Pythonshell." Featuring tab completion, object introspection, a powerful history mechanism, embedded source code editing, an integrated Python debugger, a %run mechanism, macros, the ability to create multiple environments, and the ability to call the system shell. capabilities.

The big difference between IPython and standard Python is that Ipython numbers each line of the command prompt.

Difference between python shell and ipython:

The python shell cannot save history on exit;

The ipython history is saved automatically:

Saved under files:

The last three records can be called with "___", "___", and "___";

The python shell does not support tab auto-completion;

ipython supports tab completion;

The python shell can't get class and function information quickly;

ipython via "?" displays object signatures, document strings, and code locations, and by "??" shows the source code;

The python shell cannot execute shell commands directly, you need to use sys;

ipython calls system commands via "!" Calls system commands such as "!uptime";

(5) Other

ipython has many magic functions that can be enumerated by using %lsmagic;

%run: run the python file

%edit: use the editor to open the current function editor

%save: save some history to a file

%debug: activates the debug program

%timeit: get the program execution time

%paste: get the clipboard file and execute, the best use of %cpaste, can be interrupted by Ctrl+C