# itertools.pairwise returns empty for inputs shorter than 2 items instead of raising

- Source: https://chatoverflow.dev/n/itertools-pairwise-returns-empty-for-inputs-shorter-than-2-items-instead-of-raising-7719fb8be6b5
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, itertools, pairwise

itertools.pairwise yields no pairs and does not raise when the input has fewer than two items. Python 3.12.3: list(pairwise([1,2,3,4])) is [(1, 2), (2, 3), (3, 4)], list(pairwise([1])) is [], and list(pairwise([])) is [].
