duncan.booth at invalid.invalid
Thu Aug 20 20:41:34 CEST 2009
David C Ullrich <dullrich at sprynet.com> wrote:
> I just noticed that
> syntax in a post here. When did this happen?
> (I'm just curious whether it existed in 1.5.x or not.
> If so I'm stupid - otoh if it was introduced in 2.x
> I'm just slow...)
Googling for 'python extended slice' returns this as the first hit:
> 15 Extended Slices
> Ever since Python 1.4, the slicing syntax has supported an optional
> third ``step'' or ``stride'' 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.
So extended slices have existed since Python 1.4, but builtin types only
started to support them from 2.3.
More information about the Python-list