##// END OF EJS Templates
Some extra info about tab completion in documentation.
Matthias Bussonnier -
Show More
@@ -39,7 +39,7 b' IPython you can use the up and down arrow keys when editing multi-line'
39 code blocks.
39 code blocks.
40
40
41 Here is an example of a longer interaction with the IPython REPL,
41 Here is an example of a longer interaction with the IPython REPL,
42 which we often refer to as an IPython _session_ ::
42 which we often refer to as an IPython *session* ::
43
43
44 In [1]: print('Hello IPython')
44 In [1]: print('Hello IPython')
45 Hello IPython
45 Hello IPython
@@ -51,10 +51,18 b' which we often refer to as an IPython _session_ ::'
51 ...: print('Hello {name}'.format(name=name))
51 ...: print('Hello {name}'.format(name=name))
52 ...:
52 ...:
53
53
54 We won't get into details right now, but you may notice a few differences to the standard Python REPL.
54 We won't get into details right now, but you may notice a few differences to
55 First, your code should be syntax-highlighted as you type.
55 the standard Python REPL. First, your code should be syntax-highlighted as you
56 Second, you will see that some results will have an ``Out[N]:`` prompt, while
56 type. Second, you will see that some results will have an ``Out[N]:`` prompt,
57 some other do not. We'll come to this later.
57 while some other do not. We'll come to this later.
58
59 Depending on the exact command you are typing you might realize that sometime
60 the :key:`Enter` will add a new line, and sometime it will execute the current
61 statement. IPython tries to guess what you are doing, so most of the time you
62 should not have to care. Though if by any chance IPython does not the right
63 thing you can force execution of the current code block by pressing in sequence
64 :key:`Esc` and :key:`Enter`. You can also force the insertion of a new line at
65 the position of the cursor by using `Ctrl-O`.
58
66
59 The four most helpful commands
67 The four most helpful commands
60 ==============================
68 ==============================
@@ -79,6 +87,20 b" structure of any object you're dealing with. Simply type ``object_name.<TAB>``"
79 to view the object's attributes. Besides Python objects and keywords, tab
87 to view the object's attributes. Besides Python objects and keywords, tab
80 completion also works on file and directory names.
88 completion also works on file and directory names.
81
89
90 Starting with IPython 6.0, if ``jedi`` is installed, IPython will try to pull
91 completions from Jedi as well. This allow to not only inspect currently
92 existing objects, but also to infer completion statically without executing
93 code. There is nothing particular to do this to work, simply use tab
94 completion on more complex expression like the following::
95
96 >>> data = ['Number of users', 123_456]
97 ... data[0].<tab>
98
99 IPython and Jedi will be able to infer that ``data[0]`` is actually a string
100 and should show relevant completions like ``upper()``, ``lower()`` and other
101 string methods. You can use the Tab key to cycle through completions, and while
102 a completion is highlighted, its type will be shown as well.
103
82 Exploring your objects
104 Exploring your objects
83 ======================
105 ======================
84
106
General Comments 0
You need to be logged in to leave comments. Login now