Skip to content

Commit 2101e01

Browse files
authored
Clarify Array Slicing Syntax from 'array[start:stop[:step]]' to 'array[start:stop:step]' (#465)
* Clarified Array Slicing Syntax * Update numpy-basics.ipynb Thank you for the feedback. I appreciate the concern about the notation implying that the second colon and the step parameter are mandatory. I propose we adopt 'array[start:stop:step]' as the primary notation in examples but include a clear note in the text explaining that the step parameter is optional: "The step parameter is optional and can be omitted, in which case the slice uses a default step of 1." * Resolved issue with wrong use of parenthesis ` `
1 parent 07bcc55 commit 2101e01

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/numpy/numpy-basics.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@
700700
"source": [
701701
"### Slices\n",
702702
"\n",
703-
"Slicing syntax is written as `array[start:stop[:step]]`, where **all numbers are optional**.\n",
703+
"Slicing syntax is written as `array[start:stop:step]`. Note that **all numbers are optional**. Importantly, the **step** parameter is optional and can be omitted, in which case the slice uses a default step of 1.\n",
704704
"- defaults: \n",
705705
" - start = 0\n",
706706
" - stop = len(dim)\n",

0 commit comments

Comments
 (0)