Show More
@@ -1,8 +1,8 b'' | |||||
1 |
================= |
|
1 | ================= | |
2 |
|
|
2 | Python vs IPython | |
3 |
================= |
|
3 | ================= | |
4 |
|
4 | |||
5 |
This document is meant to highlight the main differences between the |
|
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 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 | |
@@ -33,7 +33,7 b' All the following construct are valid IPython syntax :' | |||||
33 |
|
33 | |||
34 | .. code-block:: |
|
34 | .. code-block:: | |
35 |
|
35 | |||
36 | *patern*? |
|
36 | *pattern*? | |
37 |
|
37 | |||
38 | .. code-block:: |
|
38 | .. code-block:: | |
39 |
|
39 | |||
@@ -108,7 +108,7 b' and if possible display the python source code of this object.' | |||||
108 | .. code-block:: |
|
108 | .. code-block:: | |
109 |
|
109 | |||
110 | In[1]: import collections |
|
110 | In[1]: import collections | |
111 | In[2]: collection.Counter? |
|
111 | In[2]: collection.Counter?? | |
112 |
|
112 | |||
113 | Init signature: collections.Counter(*args, **kwds) |
|
113 | Init signature: collections.Counter(*args, **kwds) | |
114 | Source: |
|
114 | Source: | |
@@ -129,9 +129,9 b' and if possible display the python source code of this object.' | |||||
129 |
|
129 | |||
130 |
|
130 | |||
131 |
|
131 | |||
132 |
If you are looking for an object, the use of wildcards ``*`` in conj |
|
132 | If you are looking for an object, the use of wildcards ``*`` in conjunction | |
133 | with question mark will allow you to search current namespace for object with |
|
133 | with question mark will allow you to search current namespace for object with | |
134 |
mat |
|
134 | matching names: | |
135 |
|
135 | |||
136 | .. code-block:: |
|
136 | .. code-block:: | |
137 | In [24]: *int*? |
|
137 | In [24]: *int*? | |
@@ -145,7 +145,7 b' Shell Assignment' | |||||
145 |
|
145 | |||
146 |
|
146 | |||
147 | When doing interactive computing it is common to need to access the underlying shell. |
|
147 | When doing interactive computing it is common to need to access the underlying shell. | |
148 | This is doable through th use of the exclamation mark ``!`` (or bang). |
|
148 | This is doable through the use of the exclamation mark ``!`` (or bang). | |
149 |
|
149 | |||
150 | This allow to execute simple command when present in beginning of line: |
|
150 | This allow to execute simple command when present in beginning of line: | |
151 |
|
151 | |||
@@ -167,9 +167,9 b' Or edit file:' | |||||
167 | In[1]: !mvim myfile.txt |
|
167 | In[1]: !mvim myfile.txt | |
168 |
|
168 | |||
169 |
|
169 | |||
170 |
The line after the bang can ca |
|
170 | The line after the bang can call any program installed in the underlying | |
171 | shell, and support variable expansion in the form of ``$variable`` or ``{variable}``. |
|
171 | shell, and support variable expansion in the form of ``$variable`` or ``{variable}``. | |
172 | The later for of expansion support arbitrary python expression: |
|
172 | The later form of expansion supports arbitrary python expression: | |
173 |
|
173 | |||
174 | .. code-block:: |
|
174 | .. code-block:: | |
175 |
|
175 | |||
@@ -180,10 +180,10 b' The later for of expansion support arbitrary python expression:' | |||||
180 |
|
180 | |||
181 | The bang can also be present in the right hand side of an assignment, just |
|
181 | The bang can also be present in the right hand side of an assignment, just | |
182 | after the equal sign, or separated from it by a white space. In which case the |
|
182 | after the equal sign, or separated from it by a white space. In which case the | |
183 |
standard output of the command after the bang ``!`` will be sp |
|
183 | standard output of the command after the bang ``!`` will be split out into lines | |
184 | in a list-like object (:see:`IPython Slist`) and assign to the left hand side. |
|
184 | in a list-like object (:see:`IPython Slist`) and assign to the left hand side. | |
185 |
|
185 | |||
186 | This allow you for example to put th list of files of the current working directory in a variable: |
|
186 | This allow you for example to put the list of files of the current working directory in a variable: | |
187 |
|
187 | |||
188 | .. code-block:: |
|
188 | .. code-block:: | |
189 |
|
189 | |||
@@ -206,7 +206,7 b' Magics' | |||||
206 |
|
206 | |||
207 | Magics function are often present in the form of shell-like syntax, but are |
|
207 | Magics function are often present in the form of shell-like syntax, but are | |
208 | under the hood python function. The syntax and assignment possibility are |
|
208 | under the hood python function. The syntax and assignment possibility are | |
209 |
similar to the one with the bang (`` |
|
209 | similar to the one with the bang (``!``) syntax, but with more flexibility and | |
210 | power. Magic function start with a percent sign (``%``) or double percent (``%%``). |
|
210 | power. Magic function start with a percent sign (``%``) or double percent (``%%``). | |
211 |
|
211 | |||
212 | A magic call with a sign percent will act only one line: |
|
212 | A magic call with a sign percent will act only one line: |
General Comments 0
You need to be logged in to leave comments.
Login now