##// END OF EJS Templates
Merge pull request #2024 from ccordoba12/iusage_in_rst...
Fernando Perez -
r7693:cc792374 merge
parent child Browse files
Show More
@@ -74,6 +74,7 At your system command line, type 'ipython -h' to see the command line
74 74 options available. This document only describes interactive features.
75 75
76 76 MAIN FEATURES
77 -------------
77 78
78 79 * Access to the standard Python help. As of Python 2.1, a help system is
79 80 available with access to object docstrings and the Python manuals. Simply
@@ -190,50 +191,66 MAIN FEATURES
190 191 * Auto-parentheses and auto-quotes (adapted from Nathan Gray's LazyPython)
191 192
192 193 1. Auto-parentheses
194
193 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 198 In [1]: callable_ob arg1, arg2, arg3
196 and the input will be translated to this:
197 ------> callable_ob(arg1, arg2, arg3)
199
200 and the input will be translated to this::
201
202 callable_ob(arg1, arg2, arg3)
203
198 204 This feature is off by default (in rare cases it can produce
199 205 undesirable side-effects), but you can activate it at the command-line
200 206 by starting IPython with `--autocall 1`, set it permanently in your
201 207 configuration file, or turn on at runtime with `%autocall 1`.
202 208
203 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 212 In [1]: /globals # becomes 'globals()'
213
206 214 Note that the '/' MUST be the first character on the line! This
207 won't work:
215 won't work::
216
208 217 In [2]: print /globals # syntax error
209 218
210 219 In most cases the automatic algorithm should work, so you should
211 220 rarely need to explicitly invoke /. One notable exception is if you
212 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 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 228 In [2]: /zip (1,2,3),(4,5,6)
217 229 ------> zip ((1,2,3),(4,5,6))
218 230 Out[2]= [(1, 4), (2, 5), (3, 6)]
219 231
220 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 235 In [18]: callable list
223 236 -------> callable (list)
224 237
225 238 2. Auto-Quoting
239
226 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 243 In [1]: ,my_function /home/me # becomes my_function("/home/me")
229 244
230 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 248 In [2]: ,my_function a b c # becomes my_function("a","b","c")
233 249 In [3]: ;my_function a b c # becomes my_function("a b c")
234 250
235 251 Note that the ',' MUST be the first character on the line! This
236 won't work:
252 won't work::
253
237 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