Extended slice notation doesn't recognise integer

Joe Francia usenet at -OBFUSCATED-joefrancia.com
Sun Feb 8 21:56:54 CET 2004


Thomas Covello wrote:
> Why does the following code give this error:
> 
>>>>[0, 1, 2, 3, 4][::2]
> 
> TypeError: sequence index must be integer

This is what I get:

 >>> [0, 1, 2, 3, 4][::2]
[0, 2, 4]

Are you using 2.3.x?  I believe extended slices didn't show up until 2.3.



More information about the Python-list mailing list