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

Russel Walker russ.pobox at gmail.com
Sat Jul 6 08:59:06 EDT 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:
        try:
            result += supersum(item, start)
        except:
            result += item
    return result



More information about the Python-list mailing list