Show More
@@ -32,7 +32,7 tutorial but should usually not impact the computation. | |||||
32 |
|
32 | |||
33 | You should be able to type single line expressions and press enter to evaluate |
|
33 | You should be able to type single line expressions and press enter to evaluate | |
34 | them. If an expression is incomplete, IPython will automatically detect this and |
|
34 | them. If an expression is incomplete, IPython will automatically detect this and | |
35 |
add a new line when you press |
|
35 | add a new line when you press :kbd:`Enter` instead of executing right away. | |
36 |
|
36 | |||
37 | Feel free to explore multi-line text input. Unlike many other REPLs, with |
|
37 | Feel free to explore multi-line text input. Unlike many other REPLs, with | |
38 | IPython you can use the up and down arrow keys when editing multi-line |
|
38 | IPython you can use the up and down arrow keys when editing multi-line | |
@@ -56,13 +56,13 the standard Python REPL. First, your code should be syntax-highlighted as you | |||||
56 | type. Second, you will see that some results will have an ``Out[N]:`` prompt, |
|
56 | type. Second, you will see that some results will have an ``Out[N]:`` prompt, | |
57 | while some other do not. We'll come to this later. |
|
57 | while some other do not. We'll come to this later. | |
58 |
|
58 | |||
59 | Depending on the exact command you are typing you might realize that sometime |
|
59 | Depending on the exact command you are typing you might realize that sometimes | |
60 |
|
|
60 | :kbd:`Enter` will add a new line, and sometimes it will execute the current | |
61 | statement. IPython tries to guess what you are doing, so most of the time you |
|
61 | statement. IPython tries to guess what you are doing, so most of the time you | |
62 | should not have to care. Though if by any chance IPython does not the right |
|
62 | should not have to care. Though if by any chance IPython does not the right | |
63 | thing you can force execution of the current code block by pressing in sequence |
|
63 | thing you can force execution of the current code block by pressing in sequence | |
64 |
:k |
|
64 | :kbd:`Esc` and :kbd:`Enter`. You can also force the insertion of a new line at | |
65 |
the position of the cursor by using `Ctrl- |
|
65 | the position of the cursor by using :kbd:`Ctrl-o`. | |
66 |
|
66 | |||
67 | The four most helpful commands |
|
67 | The four most helpful commands | |
68 | ============================== |
|
68 | ============================== | |
@@ -88,18 +88,18 to view the object's attributes. Besides Python objects and keywords, tab | |||||
88 | completion also works on file and directory names. |
|
88 | completion also works on file and directory names. | |
89 |
|
89 | |||
90 | Starting with IPython 6.0, if ``jedi`` is installed, IPython will try to pull |
|
90 | Starting with IPython 6.0, if ``jedi`` is installed, IPython will try to pull | |
91 | completions from Jedi as well. This allow to not only inspect currently |
|
91 | completions from Jedi as well. This allows to not only inspect currently | |
92 | existing objects, but also to infer completion statically without executing |
|
92 | existing objects, but also to infer completion statically without executing | |
93 |
code. |
|
93 | code. There is nothing particular need to get this to work, simply use tab | |
94 | completion on more complex expression like the following:: |
|
94 | completion on more complex expressions like the following:: | |
95 |
|
95 | |||
96 | >>> data = ['Number of users', 123_456] |
|
96 | >>> data = ['Number of users', 123_456] | |
97 | ... data[0].<tab> |
|
97 | ... data[0].<tab> | |
98 |
|
98 | |||
99 | IPython and Jedi will be able to infer that ``data[0]`` is actually a string |
|
99 | IPython and Jedi will be able to infer that ``data[0]`` is actually a string | |
100 | and should show relevant completions like ``upper()``, ``lower()`` and other |
|
100 | and should show relevant completions like ``upper()``, ``lower()`` and other | |
101 |
string methods. You can use the Tab key to cycle through completions, |
|
101 | string methods. You can use the :kbd:`Tab` key to cycle through completions, | |
102 |
a completion is highlighted, its type will be shown as well. |
|
102 | and while a completion is highlighted, its type will be shown as well. | |
103 |
|
103 | |||
104 | Exploring your objects |
|
104 | Exploring your objects | |
105 | ====================== |
|
105 | ====================== | |
@@ -127,7 +127,7 separate argument. | |||||
127 | Magics are useful as convenient functions where Python syntax is not the most |
|
127 | Magics are useful as convenient functions where Python syntax is not the most | |
128 | natural one, or when one want to embed invalid python syntax in their work flow. |
|
128 | natural one, or when one want to embed invalid python syntax in their work flow. | |
129 |
|
129 | |||
130 | The following examples show how to call the builtin :magic:`timeit` magic, both |
|
130 | The following examples show how to call the built-in :magic:`timeit` magic, both | |
131 | in line and cell mode:: |
|
131 | in line and cell mode:: | |
132 |
|
132 | |||
133 | In [1]: %timeit range(1000) |
|
133 | In [1]: %timeit range(1000) | |
@@ -138,7 +138,7 in line and cell mode:: | |||||
138 | ...: |
|
138 | ...: | |
139 | 1000 loops, best of 3: 223 us per loop |
|
139 | 1000 loops, best of 3: 223 us per loop | |
140 |
|
140 | |||
141 | The builtin magics include: |
|
141 | The built-in magics include: | |
142 |
|
142 | |||
143 | - Functions that work with code: :magic:`run`, :magic:`edit`, :magic:`save`, |
|
143 | - Functions that work with code: :magic:`run`, :magic:`edit`, :magic:`save`, | |
144 | :magic:`macro`, :magic:`recall`, etc. |
|
144 | :magic:`macro`, :magic:`recall`, etc. | |
@@ -184,7 +184,7 imported modules, which have to be specifically reloaded). IPython also includes | |||||
184 | for running them under the control of either Python's pdb debugger (-d) or |
|
184 | for running them under the control of either Python's pdb debugger (-d) or | |
185 | profiler (-p). |
|
185 | profiler (-p). | |
186 |
|
186 | |||
187 | The :magic:`edit` command gives a reasonable approximation of multiline editing, |
|
187 | The :magic:`edit` command gives a reasonable approximation of multi-line editing, | |
188 | by invoking your favorite editor on the spot. IPython will execute the |
|
188 | by invoking your favorite editor on the spot. IPython will execute the | |
189 | code you type in there as if it were typed interactively. Note that for |
|
189 | code you type in there as if it were typed interactively. Note that for | |
190 | :magic:`edit` to work, the call to startup your editor has to be a blocking |
|
190 | :magic:`edit` to work, the call to startup your editor has to be a blocking |
General Comments 0
You need to be logged in to leave comments.
Login now