KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've changed some code that used a list to using a deque. I can no longer slice into it, as I get the error: TypeError: sequence index must be integer, not 'slice' Here's a REPL that shows the problem. >>> import collections >>> d = collections.deque() >>> for i in range(3): ... d.append(i) ... >>> d deque([0, 1, 2]) >>> d[2:] Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: sequence index must be integer, not 'slice' So, is there a workaround to support slicing into deques in Python?
Tags (comma-separated)
Save Edits
Cancel