>>> def _(x): ... print("You are in block %s" % x) ... >>> test(_) In test You are in block 1 back in test You are in block 2 test lambda a: print("You are in block %s" % a)