Well if you can get Raymond to agree on that too I suppose you can go ahead. Personally I'm -0 but I don't really write this kind of algorithmic code enough to know what's useful. I do think that the new parameter name is ugly. But maybe that's the point.
On Sat, Apr 7, 2018 at 10:26 PM, Tim Peters <tim.pet...@gmail.com> wrote: > Top-posting just to say I agree with Nick's bottom line (changing the > name to `first_result=`). I remain just +0.5, although that is up a > notch from yesterday's +0.4 ;-) > > --- nothing new below --- > > On Sun, Apr 8, 2018 at 12:19 AM, Nick Coghlan <ncogh...@gmail.com> wrote: > > On 8 April 2018 at 14:31, Guido van Rossum <gu...@python.org> wrote: > >> Given that two respected members of the community so strongly disagree > >> whether accumulate(, start=0) should behave like accumulate() or > like > >> accumulate(), maybe in the end it's better not to add a start > argument. > >> (The disagreement suggests that we can't trust users' intuition here.) > > > > The potential ambiguity I see is created mainly by calling the > > proposed parameter "start", while having it do more than just adjust > > the individual partial sum calculations by adding an extra partial > > result to the output series. > > > > If it's called something else (e.g. "first_result"), then the > > potential "sum(iterable, start=start)" misinterpretation goes away, > > and it can have Tim's desired effect of defining the first output > > value (effectively prepending it to the input iterable, without the > > boilerplate and overhead of actually doing so). > > > > A name like "first_result" would also make it clearer to readers that > > passing that parameter has an impact on the length of the output > > series (since you're injecting an extra result), and also that the > > production of the first result skips calling func completely (as can > > be seen in Tim's str coercion example). > > > > So where I'd be -1 on: > > > > >>> list(accumulate(1, 2, 3)) > > [1, 3, 6] > > >>> list(accumulate(1, 2, 3, start=0)) > > [0, 1, 3, 6] > > >>> list(accumulate(1, 2, 3, start=1)) > > [1, 2, 4, 7] > > > > I'd be +1 on: > > > > >>> list(accumulate(1, 2, 3)) > > [1, 3, 6] > > >>> list(accumulate(1, 2, 3, first_result=0)) > > [0, 1, 3, 6] > > >>> list(accumulate(1, 2, 3, first_result=1)) > > [1, 2, 4, 7] > > > > Cheers, > > Nick. > > > > -- > > Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia > -- --Guido van Rossum (python.org/~guido)
_______________________________________________ Python-ideas mailing list Pythonemail@example.com https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/