brandizzi

Eager evaluation in Python

Jul 23rd, 2014
17
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def f(a, b):
  2.     print("1st value will be printed")
  3.     print(a)
  4.  
  5. f(2, print('ok'))
  6. # Output:
  7. # ok
  8. # 1st value will be printed
  9. # 2
  10.  
  11. f(print('ok'), 2)
  12. # Output:
  13. # ok
  14. # 1st value will be printed
  15. # None
RAW Paste Data