kuroko/test/testSlicers.krk.expect
K. Lange 6613db6cd4 Implement slice objects, slice stepping
This is an initial implementation of slice stepping and slice objects.
The __getslice__, __setslice__, and __delslice__ methods have been removed.
Slice expressions are now turned into slice objects with the OP_SLICE instruction.
Slice objects have a start, end, and step, all of which default to None.
Slice objects are passed to __getitem__, et al., as a normal parameter.

Support for slices in list.__getitem__, str.__getitem__, and bytes.__getitem__ has
been implemented.
2022-05-03 16:49:58 +09:00

27 lines
685 B
Plaintext

[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]
[13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1]
[1, 3, 5, 7, 9, 11, 13]
[13, 11, 9, 7, 5, 3, 1]
[2]
[2, 5]
[6, 3]
こんにちは、みんなさま。クロコへようこそ。
。そこうよへコロク。まさなんみ、はちにんこ
こにはみなまクコよこ。
。こよコクまなみはにこ
んは
、に
slice(None, None, None)
slice(None, None, -1)
slice(1, 2, 3)
slice('a', 'b', 'c')
slice(None, None, None)
slice(None, 'end', None)
slice('start', None, None)
slice(None, 'end', None)
slice(None, 'end', 'step')
slice('start', None, 'step')
(slice(1, 2, None), slice(3, 4, None))
(slice(1, 2, 3), slice(None, None, 4))