Extended slice notation doesn't recognise integer

P

Paul Prescod

Thomas said:
Why does the following code give this error:
[0, 1, 2, 3, 4][::2]

TypeError: sequence index must be integer

In Python 2.2 lists did not support extended slice notation but in 2.3
they do.

Python 2.3.2 (#4, Feb 2 2004, 00:30:40)
[GCC 3.1 20020420 (prerelease)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
[0, 2, 4]

http://www.python.org/peps/pep-0283.html
"This document describes the development and release schedule for Python
2.3."

"Extended slice notation for all built-in sequences. The patch by
Michael Hudson is now all checked in."

Paul Prescod
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,999
Latest member
MakersCBDGummiesReview

Latest Threads

Top