Peter O'Connor wrote:
The behaviour where the first element of the return is the same as the first element of the input can be weird and confusing. E.g. compare:

 >> list(itertools.accumulate([2, 3, 4], lambda accum, val: accum-val))
[2, -1, -5]
 >> list(itertools.accumulate([2, 3, 4], lambda accum, val: val-accum))
[2, 1, 3]

This is another symptom of the fact that the first item in
the list is taken to be the initial value. There's no way
to interpret these results in terms of an assumed initial
value, because neither of those functions has a left
identity.

--
Greg
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to