Simple recursive sum function | what's the cause of the weird behaviour?

Russel Walker russ.pobox at
Sat Jul 6 14:59:06 CEST 2013

Since I've already wasted a thread I might as well...

Does this serve as an acceptable solution?

def supersum(sequence, start=0):
    result = type(start)()
    for item in sequence:
            result += supersum(item, start)
            result += item
    return result

More information about the Python-list mailing list