From 2101e019fb2fd0f9fbf79e6256ac5b2d1daf2600 Mon Sep 17 00:00:00 2001 From: Nursultan Sagyntay <98964550+kazakhpunk@users.noreply.github.com> Date: Mon, 20 May 2024 23:24:38 +0500 Subject: [PATCH] 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 ` ` --- core/numpy/numpy-basics.ipynb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/numpy/numpy-basics.ipynb b/core/numpy/numpy-basics.ipynb index 3281deb5b..b798d2136 100644 --- a/core/numpy/numpy-basics.ipynb +++ b/core/numpy/numpy-basics.ipynb @@ -700,7 +700,7 @@ "source": [ "### Slices\n", "\n", - "Slicing syntax is written as `array[start:stop[:step]]`, where **all numbers are optional**.\n", + "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", "- defaults: \n", " - start = 0\n", " - stop = len(dim)\n",