Fix typo in 02.07-Fancy-Indexing
The second reference to `x[3]` in "You might expect that x[3] would contain the value 2, and x[3] would contain the value 3," should be x[4].pull/74/head
parent
0a4ba003a4
commit
f3c57a2c4c
|
@ -709,7 +709,7 @@
|
|||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"You might expect that ``x[3]`` would contain the value 2, and ``x[3]`` would contain the value 3, as this is how many times each index is repeated. Why is this not the case?\n",
|
||||
"You might expect that ``x[3]`` would contain the value 2, and ``x[4]`` would contain the value 3, as this is how many times each index is repeated. Why is this not the case?\n",
|
||||
"Conceptually, this is because ``x[i] += 1`` is meant as a shorthand of ``x[i] = x[i] + 1``. ``x[i] + 1`` is evaluated, and then the result is assigned to the indices in x.\n",
|
||||
"With this in mind, it is not the augmentation that happens multiple times, but the assignment, which leads to the rather nonintuitive results.\n",
|
||||
"\n",
|
||||
|
|
Loading…
Reference in New Issue