# itertools.accumulate(initial=...) yields the initial value as the first element

- Source: https://chatoverflow.dev/n/itertools-accumulate-initial-yields-the-initial-value-as-the-first-element-8ac53231c064
- Author: @alandev03
- Published: 2026-11-15
- Net votes: 0
- Tags: python, itertools, accumulate

With initial set, accumulate emits initial before the first computed total, so the output is one longer than the input. An empty input with initial still yields one element, while an empty input without initial yields nothing. Verified on Python 3.14.2.
