##// END OF EJS Templates
Make interactive_usage a bit more rst friendly...
Carlos Cordoba -
Show More
@@ -74,6 +74,7 b" At your system command line, type 'ipython -h' to see the command line"
74 options available. This document only describes interactive features.
74 options available. This document only describes interactive features.
75
75
76 MAIN FEATURES
76 MAIN FEATURES
77 -------------
77
78
78 * Access to the standard Python help. As of Python 2.1, a help system is
79 * Access to the standard Python help. As of Python 2.1, a help system is
79 available with access to object docstrings and the Python manuals. Simply
80 available with access to object docstrings and the Python manuals. Simply
@@ -190,50 +191,66 b' MAIN FEATURES'
190 * Auto-parentheses and auto-quotes (adapted from Nathan Gray's LazyPython)
191 * Auto-parentheses and auto-quotes (adapted from Nathan Gray's LazyPython)
191
192
192 1. Auto-parentheses
193 1. Auto-parentheses
194
193 Callable objects (i.e. functions, methods, etc) can be invoked like
195 Callable objects (i.e. functions, methods, etc) can be invoked like
194 this (notice the commas between the arguments):
196 this (notice the commas between the arguments)::
197
195 In [1]: callable_ob arg1, arg2, arg3
198 In [1]: callable_ob arg1, arg2, arg3
196 and the input will be translated to this:
199
197 ------> callable_ob(arg1, arg2, arg3)
200 and the input will be translated to this::
201
202 callable_ob(arg1, arg2, arg3)
203
198 This feature is off by default (in rare cases it can produce
204 This feature is off by default (in rare cases it can produce
199 undesirable side-effects), but you can activate it at the command-line
205 undesirable side-effects), but you can activate it at the command-line
200 by starting IPython with `--autocall 1`, set it permanently in your
206 by starting IPython with `--autocall 1`, set it permanently in your
201 configuration file, or turn on at runtime with `%autocall 1`.
207 configuration file, or turn on at runtime with `%autocall 1`.
202
208
203 You can force auto-parentheses by using '/' as the first character
209 You can force auto-parentheses by using '/' as the first character
204 of a line. For example:
210 of a line. For example::
211
205 In [1]: /globals # becomes 'globals()'
212 In [1]: /globals # becomes 'globals()'
213
206 Note that the '/' MUST be the first character on the line! This
214 Note that the '/' MUST be the first character on the line! This
207 won't work:
215 won't work::
216
208 In [2]: print /globals # syntax error
217 In [2]: print /globals # syntax error
209
218
210 In most cases the automatic algorithm should work, so you should
219 In most cases the automatic algorithm should work, so you should
211 rarely need to explicitly invoke /. One notable exception is if you
220 rarely need to explicitly invoke /. One notable exception is if you
212 are trying to call a function with a list of tuples as arguments (the
221 are trying to call a function with a list of tuples as arguments (the
213 parenthesis will confuse IPython):
222 parenthesis will confuse IPython)::
223
214 In [1]: zip (1,2,3),(4,5,6) # won't work
224 In [1]: zip (1,2,3),(4,5,6) # won't work
215 but this will work:
225
226 but this will work::
227
216 In [2]: /zip (1,2,3),(4,5,6)
228 In [2]: /zip (1,2,3),(4,5,6)
217 ------> zip ((1,2,3),(4,5,6))
229 ------> zip ((1,2,3),(4,5,6))
218 Out[2]= [(1, 4), (2, 5), (3, 6)]
230 Out[2]= [(1, 4), (2, 5), (3, 6)]
219
231
220 IPython tells you that it has altered your command line by
232 IPython tells you that it has altered your command line by
221 displaying the new command line preceded by -->. e.g.:
233 displaying the new command line preceded by -->. e.g.::
234
222 In [18]: callable list
235 In [18]: callable list
223 -------> callable (list)
236 -------> callable (list)
224
237
225 2. Auto-Quoting
238 2. Auto-Quoting
239
226 You can force auto-quoting of a function's arguments by using ',' as
240 You can force auto-quoting of a function's arguments by using ',' as
227 the first character of a line. For example:
241 the first character of a line. For example::
242
228 In [1]: ,my_function /home/me # becomes my_function("/home/me")
243 In [1]: ,my_function /home/me # becomes my_function("/home/me")
229
244
230 If you use ';' instead, the whole argument is quoted as a single
245 If you use ';' instead, the whole argument is quoted as a single
231 string (while ',' splits on whitespace):
246 string (while ',' splits on whitespace)::
247
232 In [2]: ,my_function a b c # becomes my_function("a","b","c")
248 In [2]: ,my_function a b c # becomes my_function("a","b","c")
233 In [3]: ;my_function a b c # becomes my_function("a b c")
249 In [3]: ;my_function a b c # becomes my_function("a b c")
234
250
235 Note that the ',' MUST be the first character on the line! This
251 Note that the ',' MUST be the first character on the line! This
236 won't work:
252 won't work::
253
237 In [4]: x = ,my_function /home/me # syntax error
254 In [4]: x = ,my_function /home/me # syntax error
238 """
255 """
239
256
General Comments 0
You need to be logged in to leave comments. Login now