Jason R. Coombs  committed 405444f

Invoke main loop as a for loop rather than a while with a break

  • Participants
  • Parent commits 49a8cab

Comments (0)

Files changed (1)

File scripts/

 # Joel Rosdahl <>
+import sys
 import argparse
+import itertools
 import irc.client
-import sys
 target = None
 "The nick or channel to which to send messages"
 def on_join(connection, event):
+def get_lines():
+    while True:
+        yield sys.stdin.readline().strip()
 def main_loop(connection):
-    while True:
-        line = sys.stdin.readline().strip()
-        if not line:
-            break
+    for line in itertools.takewhile(bool, get_lines()):
+        print(line)
         connection.privmsg(target, line)