3 ms·
I also found this: http://www.python.org/doc/2.3.5/whatsnew/section-slices.html http://www.python.org/doc/2.3.5/whatsnew/section-slices.html These are "extende
by nadim 18y ago
I also found this:
http://www.python.org/doc/2.3.5/whatsnew/section-slices.html http://www.python.org/doc/2.3.5/whatsnew/section-slices.html
These are "extended slices" and the third argument is the step. This link also explores deletion and the __getitem__ method:
One can also now pass slice objects to the __getitem__ methods of the built-in sequences:
>>> range(10).__getitem__(slice(0, 5, 2))
[0, 2, 4]
Or use slice objects directly in subscripts:
>>> range(10)[slice(0, 5, 2)]
[0, 2, 4]