Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 20th, 2012  |  syntax: Python  |  size: 0.33 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. non_null = lambda x: (i for i in x if x isnt None)
  2. # Loop time!
  3. with till_loop_stop():
  4.     with catch(KeyboardInterrupt):
  5.         for item in non_null(get_items(from_socket)):
  6.             counts['received'] += 1
  7.             for modified in modify(item):
  8.                 send_to(to_socket, modified)
  9.                 counts['sent'] += 1