John Machin wrote: > Steven Bethard wrote: [...] >> BTW, a simpler example of the same phenomenon is: >> >> py> range(10)[slice(None, None, -2)] >> [9, 7, 5, 3, 1] >> py> slice(None, None, -2).indices(10) >> (9, -1, -2) >> py> range(10)[9:-1:-2] >> [] >> > > >>> rt = range(10) > >>> rt[slice(None, None, -2)] > [9, 7, 5, 3, 1] > >>> rt[::-2] > [9, 7, 5, 3, 1] > >>> slice(None, None, -2).indices(10) > (9, -1, -2) > >>> [rt[x] for x in range(9, -1, -2)] > [9, 7, 5, 3, 1] > >>> > > Looks good to me. indices has returned a usable (start, stop, step). > Maybe the docs need expanding.
But not a usable [start: stop: step], which is what 'slice' is all about. -- --Bryan -- http://mail.python.org/mailman/listinfo/python-list