> OTOH 0 is more compatible and None is a strong candidate too... None is useless as a default return value for summation. Any code outside the summation would have to explicitly test for that value. Stick with zero. Theoretical musings are no reason to make this function hard to use.
> But I'm not so sure now. Thinking ahead to generic types, I'd like the > full signature to be: > > def sum(seq: sequence[T], initial: T = 0) -> T. > > and that's exactly what it is today. Conclusion: sum() is perfect after > all! +1 This works for me! I use sum() quite a bit and have had no disappointments with the current API. Raymond _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com