##// 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
@@ -116,13 +117,13 b' MAIN FEATURES'
116 * Search previous command history in two ways (also requires readline):
117 * Search previous command history in two ways (also requires readline):
117
118
118 - Start typing, and then use Ctrl-p (previous,up) and Ctrl-n (next,down) to
119 - Start typing, and then use Ctrl-p (previous,up) and Ctrl-n (next,down) to
119 search through only the history items that match what you've typed so
120 search through only the history items that match what you've typed so
120 far. If you use Ctrl-p/Ctrl-n at a blank prompt, they just behave like
121 far. If you use Ctrl-p/Ctrl-n at a blank prompt, they just behave like
121 normal arrow keys.
122 normal arrow keys.
122
123
123 - Hit Ctrl-r: opens a search prompt. Begin typing and the system searches
124 - Hit Ctrl-r: opens a search prompt. Begin typing and the system searches
124 your history for lines that match what you've typed so far, completing as
125 your history for lines that match what you've typed so far, completing as
125 much as it can.
126 much as it can.
126
127
127 - %hist: search history by index (this does *not* require readline).
128 - %hist: search history by index (this does *not* require readline).
128
129
@@ -189,52 +190,68 b' MAIN FEATURES'
189
190
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
193 Callable objects (i.e. functions, methods, etc) can be invoked like
194
194 this (notice the commas between the arguments):
195 Callable objects (i.e. functions, methods, etc) can be invoked like
195 In [1]: callable_ob arg1, arg2, arg3
196 this (notice the commas between the arguments)::
196 and the input will be translated to this:
197
197 ------> callable_ob(arg1, arg2, arg3)
198 In [1]: callable_ob arg1, arg2, arg3
198 This feature is off by default (in rare cases it can produce
199
199 undesirable side-effects), but you can activate it at the command-line
200 and the input will be translated to this::
200 by starting IPython with `--autocall 1`, set it permanently in your
201
201 configuration file, or turn on at runtime with `%autocall 1`.
202 callable_ob(arg1, arg2, arg3)
202
203
203 You can force auto-parentheses by using '/' as the first character
204 This feature is off by default (in rare cases it can produce
204 of a line. For example:
205 undesirable side-effects), but you can activate it at the command-line
205 In [1]: /globals # becomes 'globals()'
206 by starting IPython with `--autocall 1`, set it permanently in your
206 Note that the '/' MUST be the first character on the line! This
207 configuration file, or turn on at runtime with `%autocall 1`.
207 won't work:
208
208 In [2]: print /globals # syntax error
209 You can force auto-parentheses by using '/' as the first character
209
210 of a line. For example::
210 In most cases the automatic algorithm should work, so you should
211
211 rarely need to explicitly invoke /. One notable exception is if you
212 In [1]: /globals # becomes 'globals()'
212 are trying to call a function with a list of tuples as arguments (the
213
213 parenthesis will confuse IPython):
214 Note that the '/' MUST be the first character on the line! This
214 In [1]: zip (1,2,3),(4,5,6) # won't work
215 won't work::
215 but this will work:
216
216 In [2]: /zip (1,2,3),(4,5,6)
217 In [2]: print /globals # syntax error
217 ------> zip ((1,2,3),(4,5,6))
218
218 Out[2]= [(1, 4), (2, 5), (3, 6)]
219 In most cases the automatic algorithm should work, so you should
219
220 rarely need to explicitly invoke /. One notable exception is if you
220 IPython tells you that it has altered your command line by
221 are trying to call a function with a list of tuples as arguments (the
221 displaying the new command line preceded by -->. e.g.:
222 parenthesis will confuse IPython)::
222 In [18]: callable list
223
223 -------> callable (list)
224 In [1]: zip (1,2,3),(4,5,6) # won't work
224
225
225 2. Auto-Quoting
226 but this will work::
226 You can force auto-quoting of a function's arguments by using ',' as
227
227 the first character of a line. For example:
228 In [2]: /zip (1,2,3),(4,5,6)
228 In [1]: ,my_function /home/me # becomes my_function("/home/me")
229 ------> zip ((1,2,3),(4,5,6))
229
230 Out[2]= [(1, 4), (2, 5), (3, 6)]
230 If you use ';' instead, the whole argument is quoted as a single
231
231 string (while ',' splits on whitespace):
232 IPython tells you that it has altered your command line by
232 In [2]: ,my_function a b c # becomes my_function("a","b","c")
233 displaying the new command line preceded by -->. e.g.::
233 In [3]: ;my_function a b c # becomes my_function("a b c")
234
234
235 In [18]: callable list
235 Note that the ',' MUST be the first character on the line! This
236 -------> callable (list)
236 won't work:
237
237 In [4]: x = ,my_function /home/me # syntax error
238 2. Auto-Quoting
239
240 You can force auto-quoting of a function's arguments by using ',' as
241 the first character of a line. For example::
242
243 In [1]: ,my_function /home/me # becomes my_function("/home/me")
244
245 If you use ';' instead, the whole argument is quoted as a single
246 string (while ',' splits on whitespace)::
247
248 In [2]: ,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")
250
251 Note that the ',' MUST be the first character on the line! This
252 won't work::
253
254 In [4]: x = ,my_function /home/me # syntax error
238 """
255 """
239
256
240 interactive_usage_min = """\
257 interactive_usage_min = """\
General Comments 0
You need to be logged in to leave comments. Login now