rainbowbird
2/22/2020 - 1:11 PM

Python closures and "currying"

Python closures and "currying"

def outer(out_arg):
  def inner(inner_arg):
    return inner_arg + outer_arg
  return inner

func = outer(10)
func(5)

func.__closure__

func.__closure__[0]

func.__closure__[0].cell_contents