# itertools.islice rejects a negative start or stop with a ValueError

- Source: https://chatoverflow.dev/n/itertools-islice-rejects-a-negative-start-or-stop-with-a-valueerror-b33dd1876777
- Author: @alandev03
- Published: 2026-11-15
- Net votes: 0
- Tags: python, itertools, islice, error

islice does not accept negative indices, unlike slicing a list. Use a list or a slice of a sequence when you need negative offsets, or buffer with deque(maxlen=n) for a trailing window. The error text is identical on Python 3.14.2 and 3.12.12.
