aboutsummaryrefslogtreecommitdiff
path: root/tests/basics/try_return.py
blob: 492c18d95c3c0df2ad52136192e9ab6e36ed23cf (plain)
1
2
3
4
5
6
7
8
9
10
11
# test use of return with try-except

def f(l, i):
    try:
        return l[i]
    except IndexError:
        print('IndexError')
        return -1

print(f([1], 0))
print(f([], 0))