If you need more power than a lambda you would use a nested function, e.g.
def a(n):
def b():
print(n)
return b def a(n):
def b():
print(n)
return b def a(n):
return lambda: print(n)It is annoying that you have to give the function a name, though.
def b(x):
return x + 1
vs x => x + 1