Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- callCount = 0
- def f2():
- global callCount
- callCount += 1
- try:
- f2() #This line throws an error
- finally: #except works too
- f2() #This line does not throw an error!
- for i in range(3, 20):
- sys.setrecursionlimit(i)
- callCount = 0
- print "calls made with recursion limit {}:".format(i),
- try:
- f2()
- except RuntimeError:
- print callCount
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement