Show More
@@ -216,12 +216,12 b' html_additional_pages = {' | |||||
216 | # Output file base name for HTML help builder. |
|
216 | # Output file base name for HTML help builder. | |
217 | htmlhelp_basename = 'ipythondoc' |
|
217 | htmlhelp_basename = 'ipythondoc' | |
218 |
|
218 | |||
219 | intersphinx_mapping = {'python': ('http://docs.python.org/3/', None), |
|
219 | intersphinx_mapping = {'python': ('https://docs.python.org/3/', None), | |
220 |
'rpy2': ('http://rpy |
|
220 | 'rpy2': ('https://rpy2.readthedocs.io/en/version_2.8.x/', None), | |
221 | 'traitlets': ('http://traitlets.readthedocs.io/en/latest/', None), |
|
221 | 'traitlets': ('https://traitlets.readthedocs.io/en/latest/', None), | |
222 | 'jupyterclient': ('http://jupyter-client.readthedocs.io/en/latest/', None), |
|
222 | 'jupyterclient': ('https://jupyter-client.readthedocs.io/en/latest/', None), | |
223 | 'ipyparallel': ('http://ipyparallel.readthedocs.io/en/latest/', None), |
|
223 | 'ipyparallel': ('https://ipyparallel.readthedocs.io/en/latest/', None), | |
224 | 'jupyter': ('http://jupyter.readthedocs.io/en/latest/', None), |
|
224 | 'jupyter': ('https://jupyter.readthedocs.io/en/latest/', None), | |
225 | } |
|
225 | } | |
226 |
|
226 | |||
227 | # Options for LaTeX output |
|
227 | # Options for LaTeX output |
@@ -2,16 +2,28 b'' | |||||
2 | Using IPython for interactive work |
|
2 | Using IPython for interactive work | |
3 | ================================== |
|
3 | ================================== | |
4 |
|
4 | |||
|
5 | This section of IPython documentation walk you through most of the IPython | |||
|
6 | functionality. You do not need to have any deep knowledge of Python to read this | |||
|
7 | tutorial, though some section might make slightly more sens if you have already | |||
|
8 | done some work in the REPL. | |||
|
9 | ||||
|
10 | .. note:: | |||
|
11 | ||||
|
12 | Some part of this documentation are more than a decade old so might be out | |||
|
13 | of date, we welcome any report of inacuracy, and Pull Requests that make | |||
|
14 | that up to date. | |||
|
15 | ||||
5 | .. toctree:: |
|
16 | .. toctree:: | |
6 | :maxdepth: 2 |
|
17 | :maxdepth: 2 | |
|
18 | :hidden: | |||
7 |
|
19 | |||
8 | tutorial |
|
20 | tutorial | |
9 | magics |
|
|||
10 | plotting |
|
21 | plotting | |
11 | reference |
|
22 | reference | |
12 | shell |
|
23 | shell | |
13 | tips |
|
24 | tips | |
14 | python-ipython-diff |
|
25 | python-ipython-diff | |
|
26 | magics | |||
15 |
|
27 | |||
16 | .. seealso:: |
|
28 | .. seealso:: | |
17 |
|
29 |
@@ -2,4 +2,22 b'' | |||||
2 | Built-in magic commands |
|
2 | Built-in magic commands | |
3 | ======================= |
|
3 | ======================= | |
4 |
|
4 | |||
|
5 | .. note:: | |||
|
6 | ||||
|
7 | To Jupyter users: Magics are specific to and provided by the IPython kernel. | |||
|
8 | Whether magics are available on a kernel is a decision that is made by | |||
|
9 | the kernel developer on a per-kernel basis. To work properly, Magics must | |||
|
10 | use a syntax element which is not valid in the underlying language. For | |||
|
11 | example, the IPython kernel uses the `%` syntax element for magics as `%` | |||
|
12 | is not a valid unary operator in Python. While, the syntax element has | |||
|
13 | meaning in other languages. | |||
|
14 | ||||
|
15 | Here is the help auto generated from the docstrings of all the available magics | |||
|
16 | function that IPython ships with. | |||
|
17 | ||||
|
18 | You can create an register your own magics with IPython. You can find many user | |||
|
19 | defined magics on `PyPI <https://pypi.io>`_. Feel free to publish your own and | |||
|
20 | use the ``Framework :: IPython`` trove classifier. | |||
|
21 | ||||
|
22 | ||||
5 | .. include:: magics-generated.txt |
|
23 | .. include:: magics-generated.txt |
@@ -6,11 +6,11 b' One major feature of the IPython kernel is the ability to display plots that' | |||||
6 | are the output of running code cells. The IPython kernel is designed to work |
|
6 | are the output of running code cells. The IPython kernel is designed to work | |
7 | seamlessly with the matplotlib_ plotting library to provide this functionality. |
|
7 | seamlessly with the matplotlib_ plotting library to provide this functionality. | |
8 |
|
8 | |||
9 |
To set this up, before any plotting is performed you |
|
9 | To set this up, before any plotting or import of matplotlib is performed you | |
10 |
``%matplotlib`` :ref:`magic command <magics_explained>`. This |
|
10 | must execute the ``%matplotlib`` :ref:`magic command <magics_explained>`. This | |
11 |
necessary behind-the-scenes setup for IPython to work correctly |
|
11 | performs the necessary behind-the-scenes setup for IPython to work correctly | |
12 |
with ``matplotlib``; it does *not*, however, actually execute any |
|
12 | hand in hand with ``matplotlib``; it does *not*, however, actually execute any | |
13 | ``import`` commands, that is, no names are added to the namespace. |
|
13 | Python ``import`` commands, that is, no names are added to the namespace. | |
14 |
|
14 | |||
15 | If the ``%matplotlib`` magic is called without an argument, the |
|
15 | If the ``%matplotlib`` magic is called without an argument, the | |
16 | output of a plotting command is displayed using the default ``matplotlib`` |
|
16 | output of a plotting command is displayed using the default ``matplotlib`` | |
@@ -25,12 +25,18 b' Jupyter QtConsole. It can be invoked as follows::' | |||||
25 |
|
25 | |||
26 | %matplotlib inline |
|
26 | %matplotlib inline | |
27 |
|
27 | |||
28 | With this backend, the output of plotting commands is displayed *inline* |
|
28 | With this backend, the output of plotting commands is displayed *inline* within | |
29 |
|
|
29 | frontends like the Jupyter notebook, directly below the code cell that produced | |
30 | resulting plots will then also be stored in the notebook document. |
|
30 | it. The resulting plots will then also be stored in the notebook document. | |
31 |
|
31 | |||
32 | .. seealso:: |
|
32 | .. seealso:: | |
33 |
|
33 | |||
34 | `Plotting with Matplotlib`_ example notebook |
|
34 | `Plotting with Matplotlib`_ example notebook | |
35 |
|
35 | |||
|
36 | ||||
|
37 | The matplotlib_ library also ships with ``%matplotlib notebook`` command that | |||
|
38 | allows interactive figures if your environment allows it. | |||
|
39 | ||||
|
40 | See the matplotlib_ documentation for more information. | |||
|
41 | ||||
36 | .. include:: ../links.txt |
|
42 | .. include:: ../links.txt |
@@ -11,20 +11,21 b' You start IPython with the command::' | |||||
11 |
|
11 | |||
12 | $ ipython [options] files |
|
12 | $ ipython [options] files | |
13 |
|
13 | |||
14 | If invoked with no options, it executes all the files listed in sequence |
|
14 | If invoked with no options, it executes all the files listed in sequence and | |
15 | and drops you into the interpreter while still acknowledging any options |
|
15 | exits. If you add the ``-i`` flag, it drops you into the interpreter while still | |
16 |
you may have set in your ipython_config.py. This |
|
16 | acknowledging any options you may have set in your ``ipython_config.py``. This | |
17 |
standard Python, which when called as python |
|
17 | behavior is different from standard Python, which when called as python ``-i`` | |
18 | file and ignore your configuration setup. |
|
18 | will only execute one file and ignore your configuration setup. | |
19 |
|
19 | |||
20 | Please note that some of the configuration options are not available at |
|
20 | Please note that some of the configuration options are not available at the | |
21 |
|
|
21 | command line, simply because they are not practical here. Look into your | |
22 |
|
|
22 | configuration files for details on those. There are separate configuration files | |
23 |
|
|
23 | for each profile, and the files look like :file:`ipython_config.py` or | |
24 | :file:`ipython_config_{frontendname}.py`. Profile directories look like |
|
24 | :file:`ipython_config_{frontendname}.py`. Profile directories look like | |
25 |
:file:`profile_{profilename}` and are typically installed in the |
|
25 | :file:`profile_{profilename}` and are typically installed in the | |
26 | which defaults to :file:`$HOME/.ipython`. For Windows users, :envvar:`HOME` |
|
26 | :envvar:`IPYTHONDIR` directory, which defaults to :file:`$HOME/.ipython`. For | |
27 |
resolves to :file:`C:\\Users\\{YourUserName}` in |
|
27 | Windows users, :envvar:`HOME` resolves to :file:`C:\\Users\\{YourUserName}` in | |
|
28 | most instances. | |||
28 |
|
29 | |||
29 | Command-line Options |
|
30 | Command-line Options | |
30 | -------------------- |
|
31 | -------------------- | |
@@ -36,11 +37,24 b' alias to control them, but IPython lets you configure all of its objects from' | |||||
36 | the command-line by passing the full class name and a corresponding value; type |
|
37 | the command-line by passing the full class name and a corresponding value; type | |
37 | ``ipython --help-all`` to see this full list. For example:: |
|
38 | ``ipython --help-all`` to see this full list. For example:: | |
38 |
|
39 | |||
39 |
ipython -- |
|
40 | $ ipython --help-all | |
|
41 | <...snip...> | |||
|
42 | --matplotlib=<CaselessStrEnum> (InteractiveShellApp.matplotlib) | |||
|
43 | Default: None | |||
|
44 | Choices: ['auto', 'gtk', 'gtk3', 'inline', 'nbagg', 'notebook', 'osx', 'qt', 'qt4', 'qt5', 'tk', 'wx'] | |||
|
45 | Configure matplotlib for interactive use with the default matplotlib | |||
|
46 | backend. | |||
|
47 | <...snip...> | |||
|
48 | ||||
|
49 | ||||
|
50 | Indicate that the following:: | |||
|
51 | ||||
|
52 | $ ipython --matplotlib qt | |||
|
53 | ||||
40 |
|
|
54 | ||
41 | is equivalent to:: |
|
55 | is equivalent to:: | |
42 |
|
56 | |||
43 | ipython --TerminalIPythonApp.matplotlib='qt' |
|
57 | $ ipython --TerminalIPythonApp.matplotlib='qt' | |
44 |
|
58 | |||
45 | Note that in the second form, you *must* use the equal sign, as the expression |
|
59 | Note that in the second form, you *must* use the equal sign, as the expression | |
46 | is evaluated as an actual Python assignment. While in the above example the |
|
60 | is evaluated as an actual Python assignment. While in the above example the | |
@@ -145,9 +159,9 b' use it:' | |||||
145 |
|
159 | |||
146 | /home/fperez/ipython |
|
160 | /home/fperez/ipython | |
147 |
|
161 | |||
148 |
Line magics, if they return a value, can be assigned to a variable using the |
|
162 | Line magics, if they return a value, can be assigned to a variable using the | |
149 |
``l = %sx ls`` (which in this particular case returns the result of `ls` |
|
163 | syntax ``l = %sx ls`` (which in this particular case returns the result of `ls` | |
150 | See :ref:`below <manual_capture>` for more information. |
|
164 | as a python list). See :ref:`below <manual_capture>` for more information. | |
151 |
|
165 | |||
152 | Type ``%magic`` for more information, including a list of all available magic |
|
166 | Type ``%magic`` for more information, including a list of all available magic | |
153 | functions at any time and their docstrings. You can also type |
|
167 | functions at any time and their docstrings. You can also type | |
@@ -215,15 +229,6 b' The dynamic object information functions (?/??, ``%pdoc``,' | |||||
215 | directly on variables. For example, after doing ``import os``, you can use |
|
229 | directly on variables. For example, after doing ``import os``, you can use | |
216 | ``os.path.abspath??``. |
|
230 | ``os.path.abspath??``. | |
217 |
|
231 | |||
218 | .. _readline: |
|
|||
219 |
|
||||
220 | Readline-based features |
|
|||
221 | ----------------------- |
|
|||
222 |
|
||||
223 | These features require the GNU readline library, so they won't work if your |
|
|||
224 | Python installation lacks readline support. We will first describe the default |
|
|||
225 | behavior IPython uses, and then how to change it to suit your preferences. |
|
|||
226 |
|
||||
227 |
|
232 | |||
228 | Command line completion |
|
233 | Command line completion | |
229 | +++++++++++++++++++++++ |
|
234 | +++++++++++++++++++++++ | |
@@ -313,8 +318,8 b' before logging has been started.' | |||||
313 | System shell access |
|
318 | System shell access | |
314 | ------------------- |
|
319 | ------------------- | |
315 |
|
320 | |||
316 | Any input line beginning with a ! character is passed verbatim (minus |
|
321 | Any input line beginning with a ``!`` character is passed verbatim (minus | |
317 | the !, of course) to the underlying operating system. For example, |
|
322 | the ``!``, of course) to the underlying operating system. For example, | |
318 | typing ``!ls`` will run 'ls' in the current directory. |
|
323 | typing ``!ls`` will run 'ls' in the current directory. | |
319 |
|
324 | |||
320 | .. _manual_capture: |
|
325 | .. _manual_capture: | |
@@ -368,9 +373,9 b' system shell commands. These aliases can have parameters.' | |||||
368 | Then, typing ``alias_name params`` will execute the system command 'cmd |
|
373 | Then, typing ``alias_name params`` will execute the system command 'cmd | |
369 | params' (from your underlying operating system). |
|
374 | params' (from your underlying operating system). | |
370 |
|
375 | |||
371 | You can also define aliases with parameters using %s specifiers (one per |
|
376 | You can also define aliases with parameters using ``%s`` specifiers (one per | |
372 | parameter). The following example defines the parts function as an |
|
377 | parameter). The following example defines the parts function as an | |
373 |
alias to the command |
|
378 | alias to the command ``echo first %s second %s`` where each ``%s`` will be | |
374 | replaced by a positional parameter to the call to %parts:: |
|
379 | replaced by a positional parameter to the call to %parts:: | |
375 |
|
380 | |||
376 | In [1]: %alias parts echo first %s second %s |
|
381 | In [1]: %alias parts echo first %s second %s | |
@@ -427,12 +432,14 b' up for editing on the next command line.' | |||||
427 |
|
432 | |||
428 | The following variables always exist: |
|
433 | The following variables always exist: | |
429 |
|
434 | |||
430 |
* _i, _ii, _iii: store previous, next previous and next-next |
|
435 | * ``_i``, ``_ii``, ``_iii``: store previous, next previous and next-next | |
431 | * In, _ih : a list of all inputs; _ih[n] is the input from line n. If you |
|
436 | previous inputs. | |
432 | overwrite In with a variable of your own, you can remake the assignment to the |
|
437 | ||
433 | internal list with a simple ``In=_ih``. |
|
438 | * ``In``, ``_ih`` : a list of all inputs; ``_ih[n]`` is the input from line | |
|
439 | ``n``. If you overwrite In with a variable of your own, you can remake the | |||
|
440 | assignment to the internal list with a simple ``In=_ih``. | |||
434 |
|
441 | |||
435 | Additionally, global variables named _i<n> are dynamically created (<n> |
|
442 | Additionally, global variables named ``_i<n>`` are dynamically created (``<n>`` | |
436 | being the prompt counter), so ``_i<n> == _ih[<n>] == In[<n>]``. |
|
443 | being the prompt counter), so ``_i<n> == _ih[<n>] == In[<n>]``. | |
437 |
|
444 | |||
438 | For example, what you typed at prompt 14 is available as ``_i14``, ``_ih[14]`` |
|
445 | For example, what you typed at prompt 14 is available as ``_i14``, ``_ih[14]`` | |
@@ -443,10 +450,10 b' by printing them out: they print like a clean string, without prompt' | |||||
443 | characters. You can also manipulate them like regular variables (they |
|
450 | characters. You can also manipulate them like regular variables (they | |
444 | are strings), modify or exec them. |
|
451 | are strings), modify or exec them. | |
445 |
|
452 | |||
446 | You can also re-execute multiple lines of input easily by using the |
|
453 | You can also re-execute multiple lines of input easily by using the magic | |
447 |
|
|
454 | :magic:`rerun` or :magic:`macro` functions. The macro system also allows you to | |
448 |
previous lines which include magic function calls (which require |
|
455 | re-execute previous lines which include magic function calls (which require | |
449 | processing). Type %macro? for more details on the macro system. |
|
456 | special processing). Type %macro? for more details on the macro system. | |
450 |
|
457 | |||
451 | A history function :magic:`history` allows you to see any part of your input |
|
458 | A history function :magic:`history` allows you to see any part of your input | |
452 | history by printing a range of the _i variables. |
|
459 | history by printing a range of the _i variables. |
@@ -34,9 +34,8 b' Tab completion' | |||||
34 |
|
34 | |||
35 | Tab completion, especially for attributes, is a convenient way to explore the |
|
35 | Tab completion, especially for attributes, is a convenient way to explore the | |
36 | structure of any object you're dealing with. Simply type ``object_name.<TAB>`` |
|
36 | structure of any object you're dealing with. Simply type ``object_name.<TAB>`` | |
37 |
to view the object's attributes |
|
37 | to view the object's attributes. Besides Python objects and keywords, tab | |
38 | more). Besides Python objects and keywords, tab completion also works on file |
|
38 | completion also works on file and directory names. | |
39 | and directory names. |
|
|||
40 |
|
39 | |||
41 | Exploring your objects |
|
40 | Exploring your objects | |
42 | ====================== |
|
41 | ====================== | |
@@ -53,15 +52,19 b' Magic functions' | |||||
53 |
|
52 | |||
54 | IPython has a set of predefined 'magic functions' that you can call with a |
|
53 | IPython has a set of predefined 'magic functions' that you can call with a | |
55 | command line style syntax. There are two kinds of magics, line-oriented and |
|
54 | command line style syntax. There are two kinds of magics, line-oriented and | |
56 |
cell-oriented. **Line magics** are prefixed with the ``%`` character and work |
|
55 | cell-oriented. **Line magics** are prefixed with the ``%`` character and work | |
57 |
like OS command-line calls: they get as an argument the rest of the line, |
|
56 | much like OS command-line calls: they get as an argument the rest of the line, | |
58 |
arguments are passed without parentheses or quotes. |
|
57 | where arguments are passed without parentheses or quotes. **Lines magics** can | |
59 | prefixed with a double ``%%``, and they are functions that get as an argument |
|
58 | return results and can be used in the right hand side of an assignment. **Cell | |
60 | not only the rest of the line, but also the lines below it in a separate |
|
59 | magics** are prefixed with a double ``%%``, and they are functions that get as | |
61 | argument. |
|
60 | an argument not only the rest of the line, but also the lines below it in a | |
|
61 | separate argument. | |||
62 |
|
62 | |||
63 | The following examples show how to call the builtin :magic:`timeit` magic, both in |
|
63 | Magics are useful as convenient functions where Python syntax is not the most | |
64 | line and cell mode:: |
|
64 | natural one, or when one want to embed invalid python syntax in their work flow. | |
|
65 | ||||
|
66 | The following examples show how to call the builtin :magic:`timeit` magic, both | |||
|
67 | in line and cell mode:: | |||
65 |
|
68 | |||
66 | In [1]: %timeit range(1000) |
|
69 | In [1]: %timeit range(1000) | |
67 | 100000 loops, best of 3: 7.76 us per loop |
|
70 | 100000 loops, best of 3: 7.76 us per loop | |
@@ -73,20 +76,23 b' line and cell mode::' | |||||
73 |
|
76 | |||
74 | The builtin magics include: |
|
77 | The builtin magics include: | |
75 |
|
78 | |||
76 |
- Functions that work with code: :magic:`run`, :magic:`edit`, :magic:`save` |
|
79 | - Functions that work with code: :magic:`run`, :magic:`edit`, :magic:`save`, | |
77 | :magic:`recall`, etc. |
|
80 | :magic:`macro`, :magic:`recall`, etc. | |
78 | - Functions which affect the shell: :magic:`colors`, :magic:`xmode`, :magic:`autoindent`, |
|
81 | ||
79 | :magic:`automagic`, etc. |
|
82 | - Functions which affect the shell: :magic:`colors`, :magic:`xmode`, | |
80 | - Other functions such as :magic:`reset`, :magic:`timeit`, :cellmagic:`writefile`, :magic:`load`, or |
|
83 | :magic:`autoindent`, :magic:`automagic`, etc. | |
81 | :magic:`paste`. |
|
84 | ||
|
85 | - Other functions such as :magic:`reset`, :magic:`timeit`, | |||
|
86 | :cellmagic:`writefile`, :magic:`load`, or :magic:`paste`. | |||
82 |
|
87 | |||
83 |
You can always call |
|
88 | You can always call magics using the ``%`` prefix, and if you're calling a line | |
84 | magic on a line by itself, you can omit even that:: |
|
89 | magic on a line by itself, as long as the identifier is not defined in your | |
|
90 | namespace, you can omit even that:: | |||
85 |
|
91 | |||
86 | run thescript.py |
|
92 | run thescript.py | |
87 |
|
93 | |||
88 |
You can toggle this behavior by running the :magic:`automagic` magic. Cell |
|
94 | You can toggle this behavior by running the :magic:`automagic` magic. Cell | |
89 | must always have the ``%%`` prefix. |
|
95 | magics must always have the ``%%`` prefix. | |
90 |
|
96 | |||
91 | A more detailed explanation of the magic system can be obtained by calling |
|
97 | A more detailed explanation of the magic system can be obtained by calling | |
92 | ``%magic``, and for more details on any magic function, call ``%somemagic?`` to |
|
98 | ``%magic``, and for more details on any magic function, call ``%somemagic?`` to | |
@@ -95,18 +101,20 b' read its docstring. To see all the available magic functions, call' | |||||
95 |
|
101 | |||
96 | .. seealso:: |
|
102 | .. seealso:: | |
97 |
|
103 | |||
98 | :doc:`magics` |
|
104 | The :ref:`magic` section of the documentation goes more in depth into how | |
|
105 | the magics works and how to define your own, and :doc:`magics` for a list of | |||
|
106 | built-in magics. | |||
99 |
|
107 | |||
100 | `Cell magics`_ example notebook |
|
108 | `Cell magics`_ example notebook | |
101 |
|
109 | |||
102 | Running and Editing |
|
110 | Running and Editing | |
103 | ------------------- |
|
111 | ------------------- | |
104 |
|
112 | |||
105 |
The :magic:`run` magic command allows you to run any python script and load all |
|
113 | The :magic:`run` magic command allows you to run any python script and load all | |
106 | its data directly into the interactive namespace. Since the file is re-read |
|
114 | of its data directly into the interactive namespace. Since the file is re-read | |
107 | from disk each time, changes you make to it are reflected immediately (unlike |
|
115 | from disk each time, changes you make to it are reflected immediately (unlike | |
108 | imported modules, which have to be specifically reloaded). IPython also |
|
116 | imported modules, which have to be specifically reloaded). IPython also includes | |
109 |
|
|
117 | :ref:`dreload <dreload>`, a recursive reload function. | |
110 |
|
118 | |||
111 | ``%run`` has special flags for timing the execution of your scripts (-t), or |
|
119 | ``%run`` has special flags for timing the execution of your scripts (-t), or | |
112 | for running them under the control of either Python's pdb debugger (-d) or |
|
120 | for running them under the control of either Python's pdb debugger (-d) or | |
@@ -114,7 +122,9 b' profiler (-p).' | |||||
114 |
|
122 | |||
115 | The :magic:`edit` command gives a reasonable approximation of multiline editing, |
|
123 | The :magic:`edit` command gives a reasonable approximation of multiline editing, | |
116 | by invoking your favorite editor on the spot. IPython will execute the |
|
124 | by invoking your favorite editor on the spot. IPython will execute the | |
117 | code you type in there as if it were typed interactively. |
|
125 | code you type in there as if it were typed interactively. Note that for | |
|
126 | :magic:`edit` to work, the call to startup your editor has to be a blocking | |||
|
127 | call. In a GUI environment, your editor likely will have such an option. | |||
118 |
|
128 | |||
119 | Debugging |
|
129 | Debugging | |
120 | --------- |
|
130 | --------- | |
@@ -122,9 +132,9 b' Debugging' | |||||
122 | After an exception occurs, you can call :magic:`debug` to jump into the Python |
|
132 | After an exception occurs, you can call :magic:`debug` to jump into the Python | |
123 | debugger (pdb) and examine the problem. Alternatively, if you call :magic:`pdb`, |
|
133 | debugger (pdb) and examine the problem. Alternatively, if you call :magic:`pdb`, | |
124 | IPython will automatically start the debugger on any uncaught exception. You can |
|
134 | IPython will automatically start the debugger on any uncaught exception. You can | |
125 | print variables, see code, execute statements and even walk up and down the |
|
135 | print variables, see code, execute statements and even walk up and down the call | |
126 |
|
|
136 | stack to track down the true source of the problem. This can be an efficient way | |
127 |
|
|
137 | to develop and debug code, in many cases eliminating the need for print | |
128 | statements or external debugging tools. |
|
138 | statements or external debugging tools. | |
129 |
|
139 | |||
130 | You can also step through a program from the beginning by calling |
|
140 | You can also step through a program from the beginning by calling | |
@@ -157,7 +167,7 b' This will take line 3 and lines 18 to 20 from the current session, and lines' | |||||
157 | System shell commands |
|
167 | System shell commands | |
158 | ===================== |
|
168 | ===================== | |
159 |
|
169 | |||
160 | To run any command at the system shell, simply prefix it with !, e.g.:: |
|
170 | To run any command at the system shell, simply prefix it with ``!``, e.g.:: | |
161 |
|
171 | |||
162 | !ping www.bbc.co.uk |
|
172 | !ping www.bbc.co.uk | |
163 |
|
173 | |||
@@ -169,12 +179,13 b' with $: ``!grep -rF $pattern ipython/*``. See :ref:`our shell section' | |||||
169 | Define your own system aliases |
|
179 | Define your own system aliases | |
170 | ------------------------------ |
|
180 | ------------------------------ | |
171 |
|
181 | |||
172 | It's convenient to have aliases to the system commands you use most often. |
|
182 | It's convenient to have aliases to the system commands you use most often. This | |
173 |
|
|
183 | allows you to work seamlessly from inside IPython with the same commands you are | |
174 |
|
|
184 | used to in your system shell. IPython comes with some pre-defined aliases and a | |
175 |
|
|
185 | complete system for changing directories, both via a stack (see :magic:`pushd`, | |
176 |
|
|
186 | :magic:`popd` and :magic:`dhist`) and via direct :magic:`cd`. The latter keeps a | |
177 |
visited directories and allows you to go to any previously visited |
|
187 | history of visited directories and allows you to go to any previously visited | |
|
188 | one. | |||
178 |
|
189 | |||
179 |
|
190 | |||
180 | Configuration |
|
191 | Configuration |
General Comments 0
You need to be logged in to leave comments.
Login now