def make_inc():
    val = [0]

def inc():
    val[0] += 1
return val[0]
return inc
inc = make_inc()
print(inc())
print(inc())
print(inc())
Simple function that returns a number incremented by 1 on each call, without globals?