From 9e5bf27acb813dd67f005d0d4a4e3bdb391a636a Mon Sep 17 00:00:00 2001
From: Robert Griesemer a
, the primary expression
-a[lo : hi] +a[low : high]
-constructs a substring or slice. The index expressions lo
and
-hi
select which elements appear in the result. The result has
+constructs a substring or slice. The index expressions low
and
+high
select which elements appear in the result. The result has
indexes starting at 0 and length equal to
-hi
- lo
.
+high
- low
.
After slicing the array a
-For convenience, any of the index expressions may be omitted. A missing low
-index defaults to zero; a missing high index defaults to the length of the
-array, slice, or string.
+For convenience, any of the index expressions may be omitted. A missing low
+index defaults to zero; a missing high
index defaults to the length of the
+sliced operand:
+a[2:] // same a[2 : len(a)] +a[:3] // same as a[0 : 3] +a[:] // same as a[0 : len(a)] ++
For arrays or strings, the indexes low
and high
must
satisfy 0 <= low
<= high
<= length; for
--
2.48.1