|
29 | 29 | "cell_type": "markdown", |
30 | 30 | "metadata": {}, |
31 | 31 | "source": [ |
32 | | - "Hover over `square` and see an underline appear; press `Ctrl` to display tooltip with the docstring." |
| 32 | + "Hover over `square` and see an underline appear; press <kbd>Ctrl</kbd> to display tooltip with the docstring." |
33 | 33 | ] |
34 | 34 | }, |
35 | 35 | { |
|
68 | 68 | "cell_type": "markdown", |
69 | 69 | "metadata": {}, |
70 | 70 | "source": [ |
71 | | - "You can also hover over statistics and mean (while holding `Ctrl`) to see the documentation of those." |
| 71 | + "You can also hover over `statistics` and `mean` (while holding <kbd>Ctrl</kbd>) to see the documentation of those." |
72 | 72 | ] |
73 | 73 | }, |
74 | 74 | { |
|
77 | 77 | "metadata": {}, |
78 | 78 | "outputs": [ |
79 | 79 | { |
80 | | - "ename": "SyntaxError", |
81 | | - "evalue": "invalid syntax (<ipython-input-4-23d47aab6817>, line 1)", |
| 80 | + "ename": "NameError", |
| 81 | + "evalue": "name 'undefined_variable' is not defined", |
82 | 82 | "output_type": "error", |
83 | 83 | "traceback": [ |
84 | | - "\u001b[0;36m File \u001b[0;32m\"<ipython-input-4-23d47aab6817>\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m if there is invalid syntax:\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" |
| 84 | + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", |
| 85 | + "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", |
| 86 | + "\u001b[0;32m<ipython-input-4-4c6d5bf4bce5>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mundefined_variable\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", |
| 87 | + "\u001b[0;31mNameError\u001b[0m: name 'undefined_variable' is not defined" |
85 | 88 | ] |
86 | 89 | } |
87 | 90 | ], |
88 | 91 | "source": [ |
89 | | - "if there is invalid syntax:\n", |
90 | | - " pass" |
| 92 | + "undefined_variable" |
91 | 93 | ] |
92 | 94 | }, |
93 | 95 | { |
94 | 96 | "cell_type": "markdown", |
95 | 97 | "metadata": {}, |
96 | 98 | "source": [ |
97 | | - "you will see red underline (\"invalid\" and \"syntax\" above are two expressions which canno be place next to each other without an operator)" |
| 99 | + "you will see red underline for an undefined variable (example above) or for an invalid syntax." |
98 | 100 | ] |
99 | 101 | }, |
100 | 102 | { |
|
147 | 149 | "Empty cells will cause \"too many blank lines\" warning as each cell is padded with two new lines. If we remove the blank cell, everything will be perfect!" |
148 | 150 | ] |
149 | 151 | }, |
| 152 | + { |
| 153 | + "cell_type": "markdown", |
| 154 | + "metadata": {}, |
| 155 | + "source": [ |
| 156 | + "#### Diagnostics Panel" |
| 157 | + ] |
| 158 | + }, |
| 159 | + { |
| 160 | + "cell_type": "markdown", |
| 161 | + "metadata": {}, |
| 162 | + "source": [ |
| 163 | + "Search for \"Show diagnostics panel\" in the commands palette, or invoke it from the context menu to display all the diagnostics from the file in one place.\n", |
| 164 | + "\n", |
| 165 | + "The diagnostics panel allows you to sort the inspections and go to the respective locations in the code (just click on the row of interest)." |
| 166 | + ] |
| 167 | + }, |
150 | 168 | { |
151 | 169 | "cell_type": "markdown", |
152 | 170 | "metadata": {}, |
|
213 | 231 | "source": [ |
214 | 232 | "Cat" |
215 | 233 | ] |
| 234 | + }, |
| 235 | + { |
| 236 | + "cell_type": "markdown", |
| 237 | + "metadata": {}, |
| 238 | + "source": [ |
| 239 | + "### Rename" |
| 240 | + ] |
| 241 | + }, |
| 242 | + { |
| 243 | + "cell_type": "markdown", |
| 244 | + "metadata": {}, |
| 245 | + "source": [ |
| 246 | + "You can rename symbols by pressing <kbd>F2</kbd> or selecting rename option from the context menu.\n", |
| 247 | + "\n", |
| 248 | + "If you rename the `test` variable below to `test2`, both occurrences (in the two following cells) will be updated:" |
| 249 | + ] |
| 250 | + }, |
| 251 | + { |
| 252 | + "cell_type": "code", |
| 253 | + "execution_count": null, |
| 254 | + "metadata": {}, |
| 255 | + "outputs": [], |
| 256 | + "source": [ |
| 257 | + "test = 1" |
| 258 | + ] |
| 259 | + }, |
| 260 | + { |
| 261 | + "cell_type": "code", |
| 262 | + "execution_count": null, |
| 263 | + "metadata": {}, |
| 264 | + "outputs": [], |
| 265 | + "source": [ |
| 266 | + "test" |
| 267 | + ] |
| 268 | + }, |
| 269 | + { |
| 270 | + "cell_type": "markdown", |
| 271 | + "metadata": {}, |
| 272 | + "source": [ |
| 273 | + "However, a local reference from a different scope (inside the `abc()` function) will be unafected:" |
| 274 | + ] |
| 275 | + }, |
| 276 | + { |
| 277 | + "cell_type": "code", |
| 278 | + "execution_count": null, |
| 279 | + "metadata": {}, |
| 280 | + "outputs": [], |
| 281 | + "source": [ |
| 282 | + "def abc():\n", |
| 283 | + " test = 2\n", |
| 284 | + " test" |
| 285 | + ] |
| 286 | + }, |
| 287 | + { |
| 288 | + "cell_type": "markdown", |
| 289 | + "metadata": {}, |
| 290 | + "source": [ |
| 291 | + "Which is different to the simplistic behaviour of the built-in search-and-replace function." |
| 292 | + ] |
216 | 293 | } |
217 | 294 | ], |
218 | 295 | "metadata": { |
|
231 | 308 | "name": "python", |
232 | 309 | "nbconvert_exporter": "python", |
233 | 310 | "pygments_lexer": "ipython3", |
234 | | - "version": "3.7.2" |
| 311 | + "version": "3.8.0" |
235 | 312 | } |
236 | 313 | }, |
237 | 314 | "nbformat": 4, |
|
0 commit comments