Name

slice

Synopsis

slice([start,]stop[,step])

Creates and returns a slice object with read-only attributes start, stop, and step bound to the respective argument values, each defaulting to None when missing. Such a slice is meant to signify the same set of indices as range( start,stop,step). Slicing syntax obj [ start:stop:step ] passes such a slice object as the argument to the __getitem__, __setitem__, or __delitem__ method of object obj, as appropriate. It is up to obj to interpret the slice objects that its methods receive. See also Section 5.3.2.4.

Get Python in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.