Skip to content

Commit a9c6d8d

Browse files
authored
Apply suggestions from code review
1 parent 26daff2 commit a9c6d8d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Doc/reference/expressions.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,11 @@ colon::
10511051
['zero', 'one', 'two', 'three', 'four', 'five']
10521052
>>> number_names[::2]
10531053
['zero', 'two', 'four']
1054+
>>> number_names[:-3]
1055+
['zero', 'one', 'two']
1056+
>>> del number_names[4:]
1057+
>>> number_names
1058+
['zero', 'one', 'two', 'three']
10541059

10551060
When a slice is evaluated, the interpreter constructs a :class:`slice` object
10561061
whose :attr:`~slice.start`, :attr:`~slice.stop` and
@@ -1072,10 +1077,11 @@ Comma-separated subscripts
10721077
The subscript can also be given as two or more comma-separated expressions
10731078
or slices::
10741079

1080+
# continuing with the SubscriptionDemo instance defined above:
10751081
>>> demo[1, 2, 3]
1076-
subscripted with (1, 2, 3)
1082+
subscripted with: (1, 2, 3)
10771083
>>> demo[1:2, 3]
1078-
subscripted with (slice(1, 2, None), 3)
1084+
subscripted with: (slice(1, 2, None), 3)
10791085

10801086
This form is commonly used with numerical libraries for slicing
10811087
multi-dimensional data.

0 commit comments

Comments
 (0)