Advertisement
Phr0zen_Penguin

for_itools_counttwb.py - Infinite for Loop

Aug 21st, 2016
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.33 KB | None | 0 0
  1. ##
  2. # [for_itools_counttwb.py]
  3. #
  4. # Infinite for loop (using lambda function, itertools.count() and itertools.takewhile())
  5. ##
  6.  
  7. from itertools import takewhile
  8. from itertools import count
  9.  
  10.  
  11. def thereIsAReasonToBreak(x):
  12.     return False
  13.  
  14.  
  15. for i in takewhile(lambda x : not thereIsAReasonToBreak(x), count()):
  16.     print(i)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement