Skip to content

Commit 0aa0256

Browse files
committed
A correction and a simplification
1 parent e755b5d commit 0aa0256

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

Doc/reference/datamodel.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,8 @@ Sequences also support slicing: ``a[start:stop]`` selects all items with index *
323323
that *start* ``<=`` *k* ``<`` *stop*. When used as an expression, a slice is a
324324
sequence of the same type. The comment above about negative subscripts also applies
325325
to negative slice positions.
326-
Note that no error is raised if a slice positions is larger than the length
327-
of the sequence.
326+
Note that no error is raised if a slice position is less than zero or larger
327+
than the length of the sequence.
328328

329329
If *start* is missing or ``None``, slicing behaves as if *start* was zero.
330330
If *stop* is missing or ``None``, slicing behaves as if *stop* was equal to

Doc/reference/expressions.rst

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1120,10 +1120,7 @@ Formal subscription grammar
11201120
subscript: `slice` | `tuple_slices`
11211121
tuple_slices: ','.(`slice` | `starred_expression`)+ [',']
11221122
slice: `proper_slice` | `assignment_expression`
1123-
proper_slice: [`lower_bound`] ":" [`upper_bound`] [ ":" [`stride`] ]
1124-
lower_bound: `expression`
1125-
upper_bound: `expression`
1126-
stride: `expression`
1123+
proper_slice: [`expression`] ":" [`expression`] [ ":" [`expression`] ]
11271124

11281125
There is a semantic difference between the alternatives for *subscript*.
11291126
If *subscript* contains ony one unstarred *slice* without a trailing comma,

0 commit comments

Comments
 (0)