# # This is a variable used in the examples below. # something = 4 # # This code creates a local variable x and then uses it. # x = 2 # ... do some stuff return x * something # # This code accomplishes the same result without a local variable # by calling a function with a parameter x. # def helper(x): # ... do some stuff return x * something return helper(2) # # This code accomplishes the same result without a local variable # and without a named function using a Python lambda. # (lambda x: x*something)(2)