Am 01.08.2011 11:11 schrieb jc:

     except:
         print "EXCEPT: " + str(n)

If you catch all exceptions here, it is clear that you only get this.

Why don't you do

except Exception, e:
    print "EXCEPT: " + str(n), e

? Then you could at least ask "why do I get a unsupported operand type(s) for +: 'NoneType' and 'long'"?

Well, these are the consequences of returning nothing (aka None) in the case of earlier errors. The first of these errors comes from

EXCEPT: 4 maximum recursion depth exceeded

so - you simply go too deep.


If you "pre-calculate" the stuff before, calling fibo(n/2) before the line with 'print "Fibo(" + str(n) + ") = " + str(fibo(n))', it succeeds.


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

Reply via email to