##// END OF EJS Templates
fix grammar/typos in docs/interactive
Mark Schmitz -
Show More
@@ -3,20 +3,20 b' Python vs IPython'
3 =================
3 =================
4
4
5 This document is meant to highlight the main differences between the Python
5 This document is meant to highlight the main differences between the Python
6 language and what are the specific construct you can do only in IPython.
6 language and what are the specific constructs you can do only in IPython.
7
7
8 Unless expressed otherwise all of the construct you will see here will raise a
8 Unless expressed otherwise all of the constructs you will see here will raise a
9 ``SyntaxError`` if run in a pure Python shell, or if executing in a Python
9 ``SyntaxError`` if run in a pure Python shell, or if executing in a Python
10 script.
10 script.
11
11
12 Each of these features are described more in detail in further part of the documentation.
12 Each of these features is described more in detail in the further parts of the documentation.
13
13
14
14
15 Quick overview:
15 Quick overview:
16 ===============
16 ===============
17
17
18
18
19 All the following construct are valid IPython syntax:
19 All the following constructs are valid IPython syntax:
20
20
21 .. code-block:: ipython
21 .. code-block:: ipython
22
22
@@ -58,8 +58,8 b' All the following construct are valid IPython syntax:'
58 ...: print $months[0];
58 ...: print $months[0];
59
59
60
60
61 Each of these construct is compiled by IPython into valid python code and will
61 Each of these constructs is compiled by IPython into valid python code and will
62 do most of the time what you expect it will do. Let see each of these example
62 do most of the time what you expect it will do. Let see each of these examples
63 in more detail.
63 in more detail.
64
64
65
65
@@ -89,8 +89,8 b' shortcut to get help. A question mark alone will bring up the IPython help:'
89 -------------
89 -------------
90 ...
90 ...
91
91
92 A single question mark before, or after an object available in current
92 A single question mark before or after an object available in the current
93 namespace will show help relative to this object:
93 name-space will show help relative to this object:
94
94
95 .. code-block:: ipython
95 .. code-block:: ipython
96
96
@@ -126,8 +126,8 b' and if possible display the python source code of this object.'
126
126
127
127
128
128
129 If you are looking for an object, the use of wildcards ``*`` in conjunction
129 If you are looking for an object the use of wildcards ``*`` in conjunction
130 with question mark will allow you to search current namespace for object with
130 with a question mark will allow you to search the current name-space for objects with
131 matching names:
131 matching names:
132
132
133 .. code-block:: ipython
133 .. code-block:: ipython
@@ -142,10 +142,10 b' Shell Assignment'
142 ================
142 ================
143
143
144
144
145 When doing interactive computing it is common to need to access the underlying shell.
145 When doing interactive computing it is a common need is accessing the underlying shell.
146 This is doable through the use of the exclamation mark ``!`` (or bang).
146 This is doable through the use of the exclamation mark ``!`` (or bang).
147
147
148 This allow to execute simple command when present in beginning of line:
148 This allows to execute simple commands when present in beginning of the line:
149
149
150 .. code-block:: ipython
150 .. code-block:: ipython
151
151
@@ -167,7 +167,7 b' Or edit file:'
167
167
168 The line after the bang can call any program installed in the underlying
168 The line after the bang can call any program installed in the underlying
169 shell, and support variable expansion in the form of ``$variable`` or ``{variable}``.
169 shell, and support variable expansion in the form of ``$variable`` or ``{variable}``.
170 The later form of expansion supports arbitrary python expression:
170 The later form of expansion supports arbitrary python expressions:
171
171
172 .. code-block:: ipython
172 .. code-block:: ipython
173
173
@@ -176,19 +176,19 b' The later form of expansion supports arbitrary python expression:'
176 In[2]: !mv $file {file.upper()}
176 In[2]: !mv $file {file.upper()}
177
177
178
178
179 The bang can also be present in the right hand side of an assignment, just
179 The bang (``!``) can also be present on the right hand side of an assignment, just
180 after the equal sign, or separated from it by a white space. In which case the
180 after the equal sign, or separated from it by a white space. In this case the
181 standard output of the command after the bang ``!`` will be split out into lines
181 standard output of the command after the bang will be split out into lines
182 in a list-like object and assign to the left hand side.
182 in a list-like object and assigned to the left hand side.
183
183
184 This allow you for example to put the list of files of the current working directory in a variable:
184 This allows you, for example, to put the list of files of the current working directory in a variable:
185
185
186 .. code-block:: ipython
186 .. code-block:: ipython
187
187
188 In[1]: my_files = !ls
188 In[1]: my_files = !ls
189
189
190
190
191 You can combine the different possibilities in for loops, condition, functions...:
191 You can combine the different possibilities in for loops, conditions, functions...:
192
192
193 .. code-block:: ipython
193 .. code-block:: ipython
194
194
@@ -202,19 +202,19 b' You can combine the different possibilities in for loops, condition, functions..'
202 Magics
202 Magics
203 ------
203 ------
204
204
205 Magics function are often present in the form of shell-like syntax, but are
205 Magics function are often present in the form of shell-like syntax, but they are
206 under the hood python function. The syntax and assignment possibility are
206 python functions under the hood. The syntax and assignment possibilities are
207 similar to the one with the bang (``!``) syntax, but with more flexibility and
207 similar to the one with the bang (``!``) syntax, but with more flexibility and
208 power. Magic function start with a percent sign (``%``) or double percent (``%%``).
208 power. Magic functions start with a percent sign (``%``) or double percent (``%%``).
209
209
210 A magic call with a sign percent will act only on one line:
210 A magic call with a percent sign will act only on one line:
211
211
212 .. code-block:: ipython
212 .. code-block:: ipython
213
213
214 In[1]: %xmode
214 In[1]: %xmode
215 Exception reporting mode: Verbose
215 Exception reporting mode: Verbose
216
216
217 And support assignment:
217 Magics support assignment:
218
218
219 .. code-block:: ipython
219 .. code-block:: ipython
220
220
@@ -224,7 +224,7 b' And support assignment:'
224 In [2]: results
224 In [2]: results
225 Out[2]: <TimeitResult : 1 loops, best of 1: 21.1 µs per loop>
225 Out[2]: <TimeitResult : 1 loops, best of 1: 21.1 µs per loop>
226
226
227 Magic with two percent sign can spread over multiple lines, but does not support assignment:
227 Magics with double percent signs (``%%``) can spread over multiple lines, but they do not support assignments:
228
228
229 .. code-block:: ipython
229 .. code-block:: ipython
230
230
General Comments 0
You need to be logged in to leave comments. Login now