5 Dec 2009 19:05
Re: Why does `sum` use a default for the `start` parameter?
> There is a choice between these two variants: > > a) require start for non-numerical sequences > b) require start for possibly empty sequences > > I don't have a preference for either, so for compatibility's sake I would > vote to keep the current one, which is a). It also stands to reason that > buggy usage in case b) is harder to detect, since the common case will > not uncover the bug (the sequence being nonempty), while for case a) it does. I prefer (b). The problem with requiring `start` for sequences of non-numerical objects is that you now have to go out and create a "zero object" of the same type as your other objects. The object class might not even have a concept of a "zero object". Ram.
RSS Feed