Skip to content

Instantly share code, notes, and snippets.

@lockie
Created April 13, 2018 09:01
Show Gist options
  • Save lockie/f91d5a5675f561f250ed5fcd2ccffdf0 to your computer and use it in GitHub Desktop.
Save lockie/f91d5a5675f561f250ed5fcd2ccffdf0 to your computer and use it in GitHub Desktop.
def multipliers():
return [lambda x, idx=i: idx * x for i in range(4)]
print([m(2) for m in multipliers()])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment