On Wed, Aug 13, 2014 at 10:46 AM, Steven D'Aprano <steve@pearwood.info> wrote:
That's another semantic change: sum() currently accepts iterators
(although not *infinite* iterators). This revision has now broken tens
of thousands of applications.
okay, how about:
def sum(items, start=0):
first = True
for item in items:
if first:
start = start + item
else:
start += item
return start
I believe that has the same effect as my other two, but only adds the requirement that "value += item" behaves the same as "value = value + item".