You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
blocktododoc iterable_or_length, also note result, if not given iterable/length, can't really be used as slice (only as canonical object) because of `infinity`
281
+
Parse a `slice` object into a `CanonicalSlice` with start, stop, step.
282
282
283
-
Parse a `slice` object into a canonical `(start, stop, step)`.
284
-
285
283
This is helpful because `slice`'s own `.start`, `.stop` and `.step` are
286
284
sometimes specified as `None` for convenience, so Python will infer
287
-
them automatically. Here we make them explicit.
288
-
289
-
if `start` is `None`, it will be set to `0` (if the `step` is positive)
290
-
or `infinity` (if the `step` is negative.)
285
+
them automatically. Here we make them explicit. If we're given an
286
+
iterable (or the length of one) in `iterable_or_length`, we'll give a
287
+
canoncial slice for that length, otherwise we'll do a generic one,
288
+
which is rarely usable for actual slicing because it often has
289
+
`infinity` in it, so it's useful only for canonalization. (e.g.
290
+
checking whether two different slices are actually equal.)
291
291
292
-
if `stop` is `None`, it will be set to `infinity` (if the `step` is
292
+
When doing a generic canonical slice (without giving an iterable or
293
+
length):
294
+
If `start` is `None`, it will be set to `0` (if the `step` is
295
+
positive) or `infinity` (if the `step` is negative.)
296
+
If `stop` is `None`, it will be set to `infinity` (if the `step` is
293
297
positive) or `0` (if the `step` is negative.)
294
-
295
-
If `step` is `None`, it will be changed to the default `1`.
298
+
If `step` is `None`, it will be changed to the default `1`.
0 commit comments