ivapopova

First-Class Functions

Sep 22nd, 2018
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.15 KB | None | 0 0
  1. def foo(f):
  2.    f()
  3.  
  4.  
  5. def bar():
  6.     print('Bar is called!')
  7.  
  8. def baz():
  9.     print('Baz is called!')
  10.  
  11.  
  12. lf = [bar, baz]
  13.  
  14. for f in lf:
  15.     foo(f)
Advertisement
Add Comment
Please, Sign In to add comment