The python ref http://docs.python.org/2/reference/datamodel.html says that:
Some sequences also support “extended slicing” with a third “step” parameter: a[i:j:k] selects all items of a with index x where x = i + n*k, n >= 0 and i <= x < j.
Then which sequence type that does not support "extend slicing" ?
These days, it'd be any user defined sequence that doesn't want/need to support it. All the current Python builtins do; In the old days - that wasn't the case... See http://www.python.org/dev/peps/pep-0283/ and you'll see...
Extended slice notation for all built-in sequences. The patch by Michael Hudson is now all checked in.
Which relates to:
http://docs.python.org/release/2.3.4/whatsnew/section-slices.html
Ever since Python 1.4, the slicing syntax has supported an optional third
step'' orstride'' argument. For example, these are all legal Python syntax: L[1:10:2], L[:-1:1], L[::-1]. This was added to Python at the request of the developers of Numerical Python, which uses the third argument extensively. However, Python's built-in list, tuple, and string sequence types have never supported this feature, raising a TypeError if you tried it. Michael Hudson contributed a patch to fix this shortcoming.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With