Show More
@@ -89,10 +89,6 Main features of the interactive shell | |||
|
89 | 89 | directly to the system shell, and using :samp:`!!` or :samp:`var = !cmd` |
|
90 | 90 | captures shell output into python variables for further use. |
|
91 | 91 | |
|
92 | * Background execution of Python commands in a separate thread. | |
|
93 | IPython has an internal job manager called jobs, and a | |
|
94 | convenience backgrounding magic function called :samp:`%bg`. | |
|
95 | ||
|
96 | 92 | * The ability to expand python variables when calling the system shell. In a |
|
97 | 93 | shell command, any python variable prefixed with :samp:`$` is expanded. A |
|
98 | 94 | double :samp:`$$` allows passing a literal :samp:`$` to the shell (for access |
@@ -104,14 +100,14 Main features of the interactive shell | |||
|
104 | 100 | |
|
105 | 101 | * A lightweight persistence framework via the :samp:`%store` command, which |
|
106 | 102 | allows you to save arbitrary Python variables. These get restored |
|
107 | automatically when your session restarts. | |
|
103 | when you run the :samp:`%store -r` command. | |
|
108 | 104 | |
|
109 | 105 | * Automatic indentation (optional) of code as you type (through the |
|
110 | 106 | readline library). |
|
111 | 107 | |
|
112 | 108 | * Macro system for quickly re-executing multiple lines of previous |
|
113 | input with a single name. Macros can be stored persistently via | |
|
114 | :samp:`%store` and edited via :samp:`%edit`. | |
|
109 | input with a single name via the :samp:`%macro` command. Macros can be | |
|
110 | stored persistently via :samp:`%store` and edited via :samp:`%edit`. | |
|
115 | 111 | |
|
116 | 112 | * Session logging (you can then later use these logs as code in your |
|
117 | 113 | programs). Logs can optionally timestamp all input, and also store |
@@ -126,8 +122,9 Main features of the interactive shell | |||
|
126 | 122 | debugging information (basically a terminal version of the cgitb |
|
127 | 123 | module). |
|
128 | 124 | |
|
129 |
* Auto-parentheses: callable objects can be |
|
|
130 |
parentheses: :samp:`sin 3` is automatically converted to |
|
|
125 | * Auto-parentheses via the :samp:`%autocall` command: callable objects can be | |
|
126 | executed without parentheses: :samp:`sin 3` is automatically converted to | |
|
127 | :samp:`sin(3)` | |
|
131 | 128 | |
|
132 | 129 | * Auto-quoting: using :samp:`,`, or :samp:`;` as the first character forces |
|
133 | 130 | auto-quoting of the rest of the line: :samp:`,my_function a b` becomes |
@@ -140,11 +137,11 Main features of the interactive shell | |||
|
140 | 137 | :samp:`>>>` or :samp:`...` such as those from other python sessions or the |
|
141 | 138 | standard Python documentation. |
|
142 | 139 | |
|
143 |
* Flexible configuration system |
|
|
144 |
allows permanent setting of all command-line |
|
|
145 |
loading, code and file execution. The system allows |
|
|
146 |
inclusion, so you can have a base file with defaults and |
|
|
147 | which load other customizations for particular projects. | |
|
140 | * Flexible :ref:`configuration system <config_overview>`. It uses a | |
|
141 | configuration file which allows permanent setting of all command-line | |
|
142 | options, module loading, code and file execution. The system allows | |
|
143 | recursive file inclusion, so you can have a base file with defaults and | |
|
144 | layers which load other customizations for particular projects. | |
|
148 | 145 | |
|
149 | 146 | * Embeddable. You can call IPython as a python shell inside your own |
|
150 | 147 | python programs. This can be used both for debugging code or for |
@@ -160,8 +157,7 Main features of the interactive shell | |||
|
160 | 157 | any script under pdb's control, automatically setting initial breakpoints for |
|
161 | 158 | you. This version of pdb has IPython-specific improvements, including |
|
162 | 159 | tab-completion and traceback coloring support. For even easier debugger |
|
163 |
access, try :samp:`%debug` after seeing an exception. |
|
|
164 | supported, see ipy_winpdb extension. | |
|
160 | access, try :samp:`%debug` after seeing an exception. | |
|
165 | 161 | |
|
166 | 162 | * Profiler support. You can run single statements (similar to |
|
167 | 163 | :samp:`profile.run()`) or complete programs under the profiler's control. |
@@ -169,10 +165,30 Main features of the interactive shell | |||
|
169 | 165 | IPython wraps this functionality with magic commands (see :samp:`%prun` |
|
170 | 166 | and :samp:`%run -p`) convenient for rapid interactive work. |
|
171 | 167 | |
|
168 | * Simple timing information. You can use the :samp:`%timeit` command to get | |
|
169 | the execution time of a Python statement or expression. This machinery is | |
|
170 | intelligent enough to do more repetitions for commands that finish very | |
|
171 | quickly in order to get a better estimate of their running time. | |
|
172 | ||
|
173 | .. sourcecode:: ipython | |
|
174 | ||
|
175 | In [5]: %timeit 1+1 | |
|
176 | 10000000 loops, best of 3: 25.5 ns per loop | |
|
177 | .. _sourcecode: | |
|
178 | ||
|
179 | In [2]: %timeit [math.sin(x) for x in range(5000)] | |
|
180 | 1000 loops, best of 3: 719 µs per loop | |
|
181 | ||
|
182 | .. | |
|
183 | ||
|
184 | To get the timing information for more than one expression, use the | |
|
185 | :samp:`%%timeit` cell magic command. | |
|
186 | ||
|
187 | ||
|
172 | 188 | * Doctest support. The special :samp:`%doctest_mode` command toggles a mode |
|
173 | that allows you to paste existing doctests (with leading :samp:`>>>` | |
|
174 | prompts and whitespace) and uses doctest-compatible prompts and | |
|
175 | output, so you can use IPython sessions as doctest code. | |
|
189 | uses doctest-compatible prompts, so you can use IPython sessions as doctest | |
|
190 | code.. By default, IPython also allows you to paste existing doctests (with | |
|
191 | leading :samp:`>>>` and :samp:`...` prompts in them | |
|
176 | 192 | |
|
177 | 193 | .. _ipythonzmq: |
|
178 | 194 |
General Comments 0
You need to be logged in to leave comments.
Login now