|
@@
-7,7
+7,7
b' language and what are the specific construct 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 construct 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 describe more in details in further part of the documentation.
|
|
12
|
Each of these features are describe more in details in further part of the documentation.
|
|
13
|
|
|
13
|
|
|
@@
-56,7
+56,7
b' All the following construct are valid IPython syntax:'
|
|
56
|
In [1]: %%perl magic --function
|
|
56
|
In [1]: %%perl magic --function
|
|
57
|
...: @months = ("July", "August", "September");
|
|
57
|
...: @months = ("July", "August", "September");
|
|
58
|
...: print $months[0];
|
|
58
|
...: print $months[0];
|
|
59
|
|
|
59
|
|
|
60
|
|
|
60
|
|
|
61
|
Each of these construct is compile by IPython into valid python code and will
|
|
61
|
Each of these construct is compile 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 example
|
|
@@
-100,7
+100,7
b' namespace will show help relative to this object:'
|
|
100
|
|
|
100
|
|
|
101
|
|
|
101
|
|
|
102
|
A double question mark will try to pull out more information about the object,
|
|
102
|
A double question mark will try to pull out more information about the object,
|
|
103
|
and if possible display the python source code of this object.
|
|
103
|
and if possible display the python source code of this object.
|
|
104
|
|
|
104
|
|
|
105
|
.. code-block:: ipython
|
|
105
|
.. code-block:: ipython
|
|
106
|
|
|
106
|
|
|
@@
-143,7
+143,7
b' Shell Assignment'
|
|
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 common to need to access 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 allow to execute simple command when present in beginning of line:
|
|
149
|
|
|
149
|
|
|
@@
-179,7
+179,7
b' The later form of expansion supports arbitrary python expression:'
|
|
179
|
The bang can also be present in the right hand side of an assignment, just
|
|
179
|
The bang can also be present in 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 which 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 (:see:`IPython Slist`) and assign to the left hand side.
|
|
182
|
in a list-like object (:ref:`IPython Slist`) and assign 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 allow you for example to put the list of files of the current working directory in a variable:
|
|
185
|
|
|
185
|
|
|
@@
-205,7
+205,7
b' Magics'
|
|
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 are
|
|
206
|
under the hood python function. The syntax and assignment possibility are
|
|
206
|
under the hood python function. The syntax and assignment possibility 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 function start with a percent sign (``%``) or double percent (``%%``).
|
|
209
|
|
|
209
|
|
|
210
|
A magic call with a sign percent will act only one line:
|
|
210
|
A magic call with a sign percent will act only one line:
|
|
211
|
|
|
211
|
|