Slice Attributes

slice.step

Raw stride argument, or None when omitted. None later means a default stride of one. A zero step can be stored in a slice object but fails when normalized or applied to a built-in sequence. This read-only attribute preserves the original object reference, not a converted integer. Use indices(length) to normalize for a concrete sequence.

Formal Syntax & Structure

python syntaxpython
value.step

Return Value

object | None

Original argument or None.

Working Example

Example Snippetpython
print(slice(4).step)print(slice(None,None,-2).step)print(slice(None,None,0).step)
Python Reference