This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Lambda Example

By: a guest on Jan 4th, 2013  |  syntax: Python  |  size: 0.13 KB  |  views: 67  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. funcs = []
  2. for s in ["hello","world"]:
  3.     func = lambda x: print(s)
  4.     funcs.append(func)
  5. funcs[0](None)
  6. funcs[1](None)
clone this paste RAW Paste Data