Russel Walker wrote:

> 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

That depends on what is an acceptable result ;)
For instance:

>>> supersum([2, 3], 1)
5
>>> supersum([[1], ["abc"]], [])
[1, 'a', 'b', 'c']


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to